mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-10 08:22:27 +01:00
Conform to POSIX and close any copies of popen() descriptors inherited by a
popen()ed child. PR: misc/7810 Submitted by: Wayne Scott <wscott@ichips.intel.com>
This commit is contained in:
parent
d6e03c9b6d
commit
26c51fb453
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=40367
@ -65,6 +65,7 @@ popen(command, type)
|
||||
FILE *iop;
|
||||
int pdes[2], pid, twoway;
|
||||
char *argv[4];
|
||||
struct pid *p;
|
||||
|
||||
/*
|
||||
* Lite2 introduced two-way popen() pipes using socketpair().
|
||||
@ -124,6 +125,9 @@ popen(command, type)
|
||||
}
|
||||
(void)close(pdes[1]);
|
||||
}
|
||||
for (p = pidlist; p; p = p->next) {
|
||||
(void)close(fileno(p->fp));
|
||||
}
|
||||
execve(_PATH_BSHELL, argv, environ);
|
||||
_exit(127);
|
||||
/* NOTREACHED */
|
||||
|
Loading…
Reference in New Issue
Block a user