mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-26 15:02:56 +02:00
my_popen: close filedescriptors before exec
This commit is contained in:
@@ -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