FACT++  1.0
int my_system ( char *  command)

Definition at line 92 of file rshServer.cxx.

References environ.

Referenced by Cmd::commandHandler().

93 {
94  int pid, status, ret, n = 0;
95 
96  if (command == 0)
97  return 1;
98  pid = fork();
99  if (pid == -1)
100  return -1;
101  if (pid == 0) {
102  char *argv[4];
103  argv[0] = "sh";
104  argv[1] = "-c";
105  argv[2] = command;
106  argv[3] = 0;
107  execve("/bin/sh", argv, environ);
108  exit(127);
109  }
110  do {
111  ret = waitpid(pid, &status,WNOHANG);
112  if(ret == -1)
113  break;
114  usleep(100000);
115  n++;
116  } while(n < 1200);
117  return status;
118 }
char ** environ

+ Here is the caller graph for this function: