/[meta-cvs]/meta-cvs/F-83F0E6A90D5BBCDFB58440970E850925.c
ViewVC logotype

Diff of /meta-cvs/F-83F0E6A90D5BBCDFB58440970E850925.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by kaz, Sat Aug 31 20:53:13 2002 UTC revision 1.4.2.1 by kaz, Tue Dec 3 07:21:05 2002 UTC
# Line 6  Line 6 
6  #include <unistd.h>  #include <unistd.h>
7  #include <sys/types.h>  #include <sys/types.h>
8  #include <sys/stat.h>  #include <sys/stat.h>
9    #include <sys/wait.h>
10    
11  /*  /*
12   * Null pointer test   * Null pointer test
# Line 166  bail: Line 167  bail:
167    free(str);    free(str);
168    return 0;    return 0;
169  }  }
170    
171    /*
172     * <unistd.h> -- fork, wait*, exec*
173     */
174    
175    int impl_spawn(const char *name, char *const *argv)
176    {
177      pid_t child = fork();
178      int result = -1;
179      int status;
180    
181      if (child == -1)
182        goto out;
183    
184      if (child == 0) {
185        execvp(name, argv);
186        _exit(EXIT_FAILURE);
187      }
188    
189      if (waitpid(child, &status, 0) == -1)
190        goto out;
191    
192      if (WIFEXITED(status))
193        result = WEXITSTATUS(status);
194    
195    out:
196      free(argv);
197      return result;
198    }

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.4.2.1

  ViewVC Help
Powered by ViewVC 1.1.5