Better fix: return vfork() again, but remove clobbering fclose()
and use _exit() instead of exit()
This commit is contained in:
parent
97779a7e37
commit
82396226ea
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=25118
@ -40,7 +40,7 @@ static char copyright[] =
|
|||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char sccsid[] = "From: @(#)vacation.c 8.2 (Berkeley) 1/26/94";
|
static char sccsid[] = "From: @(#)vacation.c 8.2 (Berkeley) 1/26/94";
|
||||||
static char rcsid[] =
|
static char rcsid[] =
|
||||||
"$Id: vacation.c,v 1.6 1997/03/29 04:33:44 imp Exp $";
|
"$Id: vacation.c,v 1.7 1997/04/23 22:25:20 ache Exp $";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -415,7 +415,7 @@ sendmessage(myname)
|
|||||||
syslog(LOG_ERR, "vacation: pipe: %s", strerror(errno));
|
syslog(LOG_ERR, "vacation: pipe: %s", strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
i = fork();
|
i = vfork();
|
||||||
if (i < 0) {
|
if (i < 0) {
|
||||||
syslog(LOG_ERR, "vacation: fork: %s", strerror(errno));
|
syslog(LOG_ERR, "vacation: fork: %s", strerror(errno));
|
||||||
exit(1);
|
exit(1);
|
||||||
@ -424,11 +424,10 @@ sendmessage(myname)
|
|||||||
dup2(pvect[0], 0);
|
dup2(pvect[0], 0);
|
||||||
close(pvect[0]);
|
close(pvect[0]);
|
||||||
close(pvect[1]);
|
close(pvect[1]);
|
||||||
fclose(mfp);
|
|
||||||
execl(_PATH_SENDMAIL, "sendmail", "-f", myname, from, NULL);
|
execl(_PATH_SENDMAIL, "sendmail", "-f", myname, from, NULL);
|
||||||
syslog(LOG_ERR, "vacation: can't exec %s: %s",
|
syslog(LOG_ERR, "vacation: can't exec %s: %s",
|
||||||
_PATH_SENDMAIL, strerror(errno));
|
_PATH_SENDMAIL, strerror(errno));
|
||||||
exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
close(pvect[0]);
|
close(pvect[0]);
|
||||||
sfp = fdopen(pvect[1], "w");
|
sfp = fdopen(pvect[1], "w");
|
||||||
|
Loading…
Reference in New Issue
Block a user