aboutsummaryrefslogtreecommitdiffstats
path: root/sbin/geom/misc
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2011-10-25 07:34:35 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2011-10-25 07:34:35 +0000
commit275ae453d60d8175d4054f543d0aca78334b20ac (patch)
tree31284dfb499aa235d0b96834e4246ac0a5ace309 /sbin/geom/misc
parentc99a654256d25b6bcdf2a972e28e3d708d30a4d3 (diff)
downloadsrc-275ae453d60d8175d4054f543d0aca78334b20ac.tar.gz
src-275ae453d60d8175d4054f543d0aca78334b20ac.zip
If 'req' is NULL, print error on stderr.
MFC after: 3 days
Notes
Notes: svn path=/head/; revision=226718
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 1409eba751cb..f7b2764a6f14 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);
}