Index: sbin/mdmfs/mdmfs.c =================================================================== --- sbin/mdmfs/mdmfs.c +++ sbin/mdmfs/mdmfs.c @@ -674,8 +674,12 @@ * Run a process with command name and arguments pointed to by the * formatted string 'cmdline'. Since system(3) is not used, the first * space-delimited token of 'cmdline' must be the full pathname of the - * program to run. The return value is the return code of the process - * spawned. If 'ofd' is non-NULL, it is set to the standard output of + * program to run. + * + * The return value is the return code of the process spawned, or a negative + * signal number, if the process exited due to an uncaught signal. + * + * If 'ofd' is non-NULL, it is set to the standard output of * the program spawned (i.e., you can read from ofd and get the output * of the program). */ @@ -771,7 +775,12 @@ free(argv); while (waitpid(pid, &status, 0) != pid) ; - return (WEXITSTATUS(status)); + if (WIFEXITED(status)) + return (WEXITSTATUS(status)); + else if (WIFSIGNALED(status)) + return (-WTERMSIG(status)); + else + err(1, "unexpected waitpid status: 0x%x", status); } static void