aboutsummaryrefslogtreecommitdiff
path: root/src/tallyman.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tallyman.c')
-rw-r--r--src/tallyman.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/tallyman.c b/src/tallyman.c
index df40fa2..c35cc9e 100644
--- a/src/tallyman.c
+++ b/src/tallyman.c
@@ -298,15 +298,25 @@ main(int argc, char **argv)
status = EX_FAILURE;
if (runcap(&rc, rcflags)) {
+ char const *emsg = strerror(errno);
json_object_set(obj, "status", json_new_bool(0));
json_object_set(obj, "error", json_new_bool(1));
- json_object_set(obj, "message",
- json_new_string(strerror(errno)));
+ json_object_set(obj, "message", json_new_string(emsg));
+ error("failed to run %s: %s", argv[0], emsg);
} else {
if (WIFEXITED(rc.rc_status)) {
status = WEXITSTATUS(rc.rc_status);
json_object_set(obj, "status",
json_new_bool(status == 0));
+ if (status
+ && rc.rc_cap[RUNCAP_STDERR].sc_nlines == 0) {
+ if (status == 127)
+ error("failed to run %s: %s", argv[0],
+ "program not found");
+ else
+ error("command %s exited with status %d",
+ argv[0], status);
+ }
} else {
char *msg = 0;
size_t siz = 0;
@@ -327,6 +337,7 @@ main(int argc, char **argv)
json_object_set(obj, "error", json_new_bool(1));
json_object_set(obj, "message", json_new_string(msg));
+ error("%s: %s", argv[0], msg);
free(msg);
}

Return to:

Send suggestions and report system problems to the System administrator.