Overview
Comment: | Updated to check return value of waitpid() |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 316b02041ae664c31ecaf387eacb4264cd852e3b |
User & Date: | rkeene on 2012-09-15 06:44:19 |
Other Links: | manifest | tags |
Context
2012-09-15
| ||
06:48 | Updated to check return value of chdir() check-in: 99eb340549 user: rkeene tags: trunk | |
06:44 | Updated to check return value of waitpid() check-in: 316b02041a user: rkeene tags: trunk | |
2012-09-09
| ||
21:25 | Corrected example in test.tcl check-in: 2c31ced898 user: rkeene tags: trunk | |
Changes
Modified initrd/admin-tclkit/kitcreator-modules/system/system.c from [1d6aabc455] to [7ecfb38f87].
1879 1879 } 1880 1880 1881 1881 static int tclsystem_tsmf_start_svc(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) { 1882 1882 struct timeval select_timeout; 1883 1883 Tcl_WideInt umask_val, timeout_val; 1884 1884 Tcl_Obj *filename_obj, *env_obj, *logfile_obj, **env_entry_objv, *cwd_obj, *umask_obj, *user_obj, *group_obj; 1885 1885 Tcl_Obj *sri_obj, *timeout_obj; 1886 - pid_t child, child_pgid = -1; 1886 + pid_t child, child_pgid = -1, waitpid_ret; 1887 1887 ssize_t read_ret; 1888 1888 time_t currtime; 1889 1889 char *argv[3], *envv[512]; 1890 1890 char *logfile, *filename, *cwd, *user, *group; 1891 1891 char logmsg[2048]; 1892 1892 fd_set read_fdset; 1893 1893 int pipe_ret, setsid_ret, execve_ret, tcl_ret, select_ret; ................................................................................ 2079 2079 write(fd, &child_pgid, sizeof(child_pgid)); 2080 2080 2081 2081 _exit(0); 2082 2082 } 2083 2083 2084 2084 if (child != 0) { 2085 2085 /* 7.parent.a. Wait for child process to terminate and collect status */ 2086 - waitpid(child, &status, 0); 2086 + waitpid_ret = waitpid(child, &status, 0); 2087 + if (waitpid_ret == ((pid_t) -1)) { 2088 + status = -1; 2089 + } 2087 2090 2088 2091 /* 7.parent.b. Set PGID (if successful, -1 otherwise) to pass back to TSMF */ 2089 2092 if (status == 0) { 2090 2093 child_pgid = getpgid(getpid()); 2091 2094 } 2092 2095 write(fd, &child_pgid, sizeof(child_pgid)); 2093 2096