|
|
@ -485,13 +485,19 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
results->status = status;
|
|
|
|
results->status = status;
|
|
|
|
if (format) {
|
|
|
|
if (format) {
|
|
|
|
char *error = malloc(256);
|
|
|
|
char *error = NULL;
|
|
|
|
va_list args;
|
|
|
|
va_list args;
|
|
|
|
va_start(args, format);
|
|
|
|
va_start(args, format);
|
|
|
|
if (error) {
|
|
|
|
int slen = vsnprintf(NULL, 0, format, args);
|
|
|
|
vsnprintf(error, 256, format, args);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
va_end(args);
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
if (slen > 0) {
|
|
|
|
|
|
|
|
error = malloc(slen + 1);
|
|
|
|
|
|
|
|
if (error != NULL) {
|
|
|
|
|
|
|
|
va_start(args, format);
|
|
|
|
|
|
|
|
vsnprintf(error, slen + 1, format, args);
|
|
|
|
|
|
|
|
va_end(args);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
results->error = error;
|
|
|
|
results->error = error;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
results->error = NULL;
|
|
|
|
results->error = NULL;
|
|
|
|