mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-30 08:51:10 +02:00
configure_network: mysystem: use vfork
This commit is contained in:
@@ -217,15 +217,17 @@ void CNetworkConfig::commitConfig(void)
|
|||||||
|
|
||||||
int mysystem(char * cmd, char * arg1, char * arg2)
|
int mysystem(char * cmd, char * arg1, char * arg2)
|
||||||
{
|
{
|
||||||
int pid, i;
|
int i;
|
||||||
switch (pid = fork())
|
pid_t pid;
|
||||||
|
int maxfd = getdtablesize();// sysconf(_SC_OPEN_MAX);
|
||||||
|
switch (pid = vfork())
|
||||||
{
|
{
|
||||||
case -1: /* can't fork */
|
case -1: /* can't fork */
|
||||||
perror("fork");
|
perror("vfork");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
case 0: /* child process */
|
case 0: /* child process */
|
||||||
for(i = 3; i < 256; i++)
|
for(i = 3; i < maxfd; i++)
|
||||||
close(i);
|
close(i);
|
||||||
if(execlp(cmd, cmd, arg1, arg2, NULL))
|
if(execlp(cmd, cmd, arg1, arg2, NULL))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user