aboutsummaryrefslogtreecommitdiff
path: root/sbin/geom
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2022-07-29 18:11:09 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2022-07-29 18:11:46 +0000
commit58cb3626762d8ec9c499a664223190648479fc5a (patch)
tree3435e884616e5725160d743fc04fbccbf2a6521a /sbin/geom
parentb0f73768220e945deebebefc4a2d63ae6a3bfe19 (diff)
downloadsrc-58cb3626762d8ec9c499a664223190648479fc5a.tar.gz
src-58cb3626762d8ec9c499a664223190648479fc5a.zip
Fix for 90e2971 that caused some geli commands to return the wrong exit status.
The reported problem is that some geli commands exit with a success status when they should exit with a failed status. The gctl_error() function is defined differently in the kernel (in sys/geom/geom_ctl.c) versus in the geom user facilities (in sbin/geom/misc/subr.c). In the kernel, calling gctl_error() causes an error return to be set while in the user version it does not. It was only by a quirk that had been added to the user geom return processing that I "cleaned up" that the lack of the user implementaion to set the error return showed up. This patch adds the missing setting of the error code when calling the user facility gctl_error(). Reported by: Jenkins Debugging by: Alan Somers Debugging by: Cy Schubert Debugging by: Li-Wen Hsu
Diffstat (limited to 'sbin/geom')
-rw-r--r--sbin/geom/misc/subr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sbin/geom/misc/subr.c b/sbin/geom/misc/subr.c
index 3985ae56edc6..297a1cc09a36 100644
--- a/sbin/geom/misc/subr.c
+++ b/sbin/geom/misc/subr.c
@@ -398,6 +398,8 @@ gctl_error(struct gctl_req *req, const char *error, ...)
fprintf(stderr, "\n");
}
va_end(ap);
+ if (req != NULL && req->nerror == 0)
+ req->nerror = EINVAL;
}
static void *