diff options
author | Garance A Drosehn <gad@FreeBSD.org> | 2002-06-04 01:16:13 +0000 |
---|---|---|
committer | Garance A Drosehn <gad@FreeBSD.org> | 2002-06-04 01:16:13 +0000 |
commit | 4a13c4d9ee779041f715d3d67923ea30b02a0aaf (patch) | |
tree | df31c1023991d0f423e1ca3932e63ce32a0dc0c9 /usr.sbin/lpr/lpd/printjob.c | |
parent | cb263c35947b04e5f9f54202f6761069e2663931 (diff) |
Avoid checking WIFEXITED and WTERMSIG in some error situations where the
value in wstatus is not related to the process that we care about.
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=97789
Diffstat (limited to 'usr.sbin/lpr/lpd/printjob.c')
-rw-r--r-- | usr.sbin/lpr/lpd/printjob.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.sbin/lpr/lpd/printjob.c b/usr.sbin/lpr/lpd/printjob.c index cacd93c81d81..ef18701880a7 100644 --- a/usr.sbin/lpr/lpd/printjob.c +++ b/usr.sbin/lpr/lpd/printjob.c @@ -602,7 +602,7 @@ print(struct printer *pp, int format, char *file) int fi, fo; FILE *fp; char *av[15], buf[BUFSIZ]; - int pid, p[2], retcode, stopped, wstatus; + int pid, p[2], retcode, stopped, wstatus, wstatus_set; struct stat stb; if (lstat(file, &stb) < 0 || (fi = open(file, O_RDONLY)) < 0) { @@ -810,6 +810,7 @@ start: exit(2); } (void) close(fi); + wstatus_set = 0; if (child < 0) retcode = 100; else { @@ -819,8 +820,10 @@ start: retcode = 100; syslog(LOG_WARNING, "%s: after execv(%s), wait() returned: %m", pp->printer, prog); - } else + } else { + wstatus_set = 1; retcode = WEXITSTATUS(wstatus); + } } child = 0; prchild = 0; @@ -839,7 +842,7 @@ start: fclose(fp); } - if (!WIFEXITED(wstatus)) { + if (wstatus_set && !WIFEXITED(wstatus)) { syslog(LOG_WARNING, "%s: filter '%c' terminated (termsig=%d)", pp->printer, format, WTERMSIG(wstatus)); return(ERROR); |