|
|
| version 1.4, 2003/11/16 11:51:14 | version 1.5, 2004/03/10 18:27:26 |
|---|---|
| Line 70 do_command(entry *e, user *u) | Line 70 do_command(entry *e, user *u) |
| static void | static void |
| child_process(entry *e, user *u) | child_process(entry *e, user *u) |
| { | { |
| int stdin_pipe[2], stdout_pipe[2]; | int stdin_pipe[2], stdout_pipe[2]; |
| register char *input_data; | char *input_data; |
| char *usernm, *mailto; | char *usernm, *mailto; |
| int children = 0; | int children = 0; |
| # if defined(LOGIN_CAP) | # if defined(LOGIN_CAP) |
| struct passwd *pwd; | struct passwd *pwd; |
| login_cap_t *lc; | login_cap_t *lc; |
| # endif | # endif |
| Line 122 child_process(entry *e, user *u) | Line 122 child_process(entry *e, user *u) |
| * If there are escaped %'s, remove the escape character. | * If there are escaped %'s, remove the escape character. |
| */ | */ |
| /*local*/{ | /*local*/{ |
| register int escaped = FALSE; | int escaped = FALSE; |
| register int ch; | int ch; |
| register char *p; | char *p; |
| for (input_data = p = e->cmd; (ch = *input_data); | for (input_data = p = e->cmd; (ch = *input_data); |
| input_data++, p++) { | input_data++, p++) { |
| Line 294 child_process(entry *e, user *u) | Line 294 child_process(entry *e, user *u) |
| */ | */ |
| if (*input_data && fork() == 0) { | if (*input_data && fork() == 0) { |
| register FILE *out = fdopen(stdin_pipe[WRITE_PIPE], "w"); | FILE *out; |
| register int need_newline = FALSE; | int need_newline = FALSE; |
| register int escaped = FALSE; | int escaped = FALSE; |
| register int ch; | int ch; |
| out = fdopen(stdin_pipe[WRITE_PIPE], "w"); | |
| if (out == NULL) { | if (out == NULL) { |
| warn("fdopen failed in child2"); | warn("fdopen failed in child2"); |
| _exit(ERROR_EXIT); | _exit(ERROR_EXIT); |
| Line 361 child_process(entry *e, user *u) | Line 362 child_process(entry *e, user *u) |
| Debug(DPROC, ("[%d] child reading output from grandchild\n", getpid())) | Debug(DPROC, ("[%d] child reading output from grandchild\n", getpid())) |
| /*local*/{ | /*local*/{ |
| register FILE *in = fdopen(stdout_pipe[READ_PIPE], "r"); | FILE *in; |
| register int ch = getc(in); | int ch; |
| in = fdopen(stdout_pipe[READ_PIPE], "r"); | |
| if (in == NULL) { | if (in == NULL) { |
| warn("fdopen failed in child"); | warn("fdopen failed in child"); |
| _exit(ERROR_EXIT); | _exit(ERROR_EXIT); |
| } | } |
| ch = getc(in); | |
| if (ch != EOF) { | if (ch != EOF) { |
| register FILE *mail; | FILE *mail; |
| register int bytes = 1; | int bytes = 1; |
| int status = 0; | int status = 0; |
| Debug(DPROC|DEXT, | Debug(DPROC|DEXT, |
| ("[%d] got data (%x:%c) from grandchild\n", | ("[%d] got data (%x:%c) from grandchild\n", |
| Line 401 child_process(entry *e, user *u) | Line 404 child_process(entry *e, user *u) |
| */ | */ |
| if (mailto) { | if (mailto) { |
| register char **env; | char **env; |
| auto char mailcmd[MAX_COMMAND]; | char mailcmd[MAX_COMMAND]; |
| auto char hostname[MAXHOSTNAMELEN]; | char hostname[MAXHOSTNAMELEN]; |
| (void) gethostname(hostname, MAXHOSTNAMELEN); | (void) gethostname(hostname, MAXHOSTNAMELEN); |
| (void) snprintf(mailcmd, sizeof(mailcmd), | (void) snprintf(mailcmd, sizeof(mailcmd), |