mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 00:41:17 +02:00
my_popen: close filedescriptors before exec
Signed-off-by: Jacek Jendrzej <crashdvb@googlemail.com>
This commit is contained in:
committed by
Jacek Jendrzej
parent
92e6d383bd
commit
3064107b90
@@ -129,6 +129,9 @@ FILE* my_popen( pid_t& pid, const char *cmdstring, const char *type)
|
||||
close(pfd[0]);
|
||||
}
|
||||
}
|
||||
int maxfd = getdtablesize();
|
||||
for(int i = 3; i < maxfd; i++)
|
||||
close(i);
|
||||
execl("/bin/sh", "sh", "-c", cmdstring, (char *)0);
|
||||
exit(0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user