[4.0] 5c54bd5 Return 2 from VSUB_run() when the sub process dies with a signal.
Lasse Karstensen
lkarsten at varnish-software.com
Mon Sep 22 16:38:24 CEST 2014
commit 5c54bd5d7c162f08d8543cf7d3043bec7c7869d4
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Fri Aug 29 14:44:36 2014 +0200
Return 2 from VSUB_run() when the sub process dies with a signal.
Fixes a regression from 33e6fe71743059b912d2b00cdbc08196b003e440
Fixes #1585
diff --git a/lib/libvarnish/vsub.c b/lib/libvarnish/vsub.c
index ffe93ab..767ec5a 100644
--- a/lib/libvarnish/vsub.c
+++ b/lib/libvarnish/vsub.c
@@ -127,15 +127,21 @@ VSUB_run(struct vsb *sb, vsub_func_f *func, void *priv, const char *name,
}
} while (rv < 0);
if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+ rv = -1;
VSB_printf(sb, "Running %s failed", name);
- if (WIFEXITED(status))
- VSB_printf(sb, ", exited with %d", WEXITSTATUS(status));
- if (WIFSIGNALED(status))
+ if (WIFEXITED(status)) {
+ rv = WEXITSTATUS(status);
+ VSB_printf(sb, ", exited with %d", rv);
+ }
+ if (WIFSIGNALED(status)) {
+ rv = 2;
VSB_printf(sb, ", signal %d", WTERMSIG(status));
+ }
if (WCOREDUMP(status))
VSB_printf(sb, ", core dumped");
VSB_printf(sb, "\n");
- return (WEXITSTATUS(status));
+ assert(rv != -1);
+ return (rv);
}
return (0);
}
More information about the varnish-commit
mailing list