If 'req' is NULL, print error on stderr.

MFC after:	3 days
This commit is contained in:
pjd 2011-10-25 07:34:35 +00:00
parent 81eb88852f
commit b6b8505c01

View File

@ -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);
}