mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 07:23:09 +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]);
|
close(pfd[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
int maxfd = getdtablesize();
|
||||||
|
for(int i = 3; i < maxfd; i++)
|
||||||
|
close(i);
|
||||||
execl("/bin/sh", "sh", "-c", cmdstring, (char *)0);
|
execl("/bin/sh", "sh", "-c", cmdstring, (char *)0);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user