virHookCall(int driver, const char *id, int op, int sub_op, const char *extra,
const char *input) {
int ret;
+ int exitstatus;
char *path;
virCommandPtr cmd;
const char *drvstr;
if (input)
virCommandSetInputBuffer(cmd, input);
- ret = virCommandRun(cmd, NULL);
+ ret = virCommandRun(cmd, &exitstatus);
+ if (ret == 0 && exitstatus != 0) {
+ virHookReportError(VIR_ERR_HOOK_SCRIPT_FAILED,
+ _("Hook script %s %s failed with error code %d"),
+ path, drvstr, exitstatus);
+ ret = -1;
+ }
virCommandFree(cmd);