Index: system.c ================================================================== --- system.c +++ system.c @@ -1881,11 +1881,11 @@ static int tclsystem_tsmf_start_svc(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { struct timeval select_timeout; Tcl_WideInt umask_val, timeout_val; Tcl_Obj *filename_obj, *env_obj, *logfile_obj, **env_entry_objv, *cwd_obj, *umask_obj, *user_obj, *group_obj; Tcl_Obj *sri_obj, *timeout_obj; - pid_t child, child_pgid = -1; + pid_t child, child_pgid = -1, waitpid_ret; ssize_t read_ret; time_t currtime; char *argv[3], *envv[512]; char *logfile, *filename, *cwd, *user, *group; char logmsg[2048]; @@ -2081,11 +2081,14 @@ _exit(0); } if (child != 0) { /* 7.parent.a. Wait for child process to terminate and collect status */ - waitpid(child, &status, 0); + waitpid_ret = waitpid(child, &status, 0); + if (waitpid_ret == ((pid_t) -1)) { + status = -1; + } /* 7.parent.b. Set PGID (if successful, -1 otherwise) to pass back to TSMF */ if (status == 0) { child_pgid = getpgid(getpid()); }