subproc: replicate bash behavior on exit values
authorRobert Swiecki <robert@swiecki.net>
Thu, 7 Jun 2018 12:59:12 +0000 (14:59 +0200)
committerRobert Swiecki <robert@swiecki.net>
Thu, 7 Jun 2018 12:59:12 +0000 (14:59 +0200)
subproc.cc

index e49156d..e4eebd7 100644 (file)
@@ -319,10 +319,7 @@ int reapProc(nsjconf_t* nsjconf) {
                                    si.si_pid, remote_txt.c_str(), WEXITSTATUS(status),
                                    countProc(nsjconf) - 1);
                                removeProc(nsjconf, si.si_pid);
-                               rv = WEXITSTATUS(status) % 100;
-                               if (rv == 0 && WEXITSTATUS(status) != 0) {
-                                       rv = 1;
-                               }
+                               rv = WEXITSTATUS(status);
                        }
                        if (WIFSIGNALED(status)) {
                                LOG_I(
@@ -331,7 +328,7 @@ int reapProc(nsjconf_t* nsjconf) {
                                    util::sigName(WTERMSIG(status)).c_str(), WTERMSIG(status),
                                    countProc(nsjconf) - 1);
                                removeProc(nsjconf, si.si_pid);
-                               rv = 100 + WTERMSIG(status);
+                               rv = 128 + WTERMSIG(status);
                        }
                }
        }