summaryrefslogtreecommitdiffstats
path: root/sbin/geom/misc
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-10-25 07:34:35 +0000
committerpjd <pjd@FreeBSD.org>2011-10-25 07:34:35 +0000
commitb6b8505c014f3f7ccd1ef206bcb23e2773711261 (patch)
tree31284dfb499aa235d0b96834e4246ac0a5ace309 /sbin/geom/misc
parent81eb88852fb341049497ac8499e2b751ef8cce4d (diff)
downloadFreeBSD-src-b6b8505c014f3f7ccd1ef206bcb23e2773711261.zip
FreeBSD-src-b6b8505c014f3f7ccd1ef206bcb23e2773711261.tar.gz
If 'req' is NULL, print error on stderr.
MFC after: 3 days
Diffstat (limited to 'sbin/geom/misc')
-rw-r--r--sbin/geom/misc/subr.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sbin/geom/misc/subr.c b/sbin/geom/misc/subr.c
index 1409eba..f7b2764 100644
--- a/sbin/geom/misc/subr.c
+++ b/sbin/geom/misc/subr.c
@@ -379,10 +379,15 @@ gctl_error(struct gctl_req *req, const char *error, ...)
{
va_list ap;
- if (req->error != NULL)
+ if (req != NULL && req->error != NULL)
return;
va_start(ap, error);
- vasprintf(&req->error, error, ap);
+ if (req != NULL) {
+ vasprintf(&req->error, error, ap);
+ } else {
+ vfprintf(stderr, error, ap);
+ fprintf(stderr, "\n");
+ }
va_end(ap);
}
OpenPOWER on IntegriCloud