015 
            26.10.2004, 11:03 Uhr 
            ~mike 
            Gast
             
            
             
             
             | 
          hmm. das stimmt. die fehlercodes kann man wirklich schwer interpretieren. das "Irgendwas ist schiefgegangen" ist dann schlussendlich auch schlecht - werde system auch auf meine schwarze liste setzen  
  Zur ergänzung noch der fbsd src; bin grade drübergestolpert. ein paar ansätze sind ident: 
   
  
  
    | C++: | 
   
  
    
      
  #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)system.c    8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */
  #include <sys/types.h> #include <sys/wait.h> #include <signal.h> #include <stdlib.h> #include <stddef.h> #include <unistd.h> #include <paths.h> #include <errno.h>
  int __system(command)     const char *command; {     pid_t pid, savedpid;     int pstat;     struct sigaction ign, intact, quitact;     sigset_t newsigblock, oldsigblock;
      if (!command)        /* just checking... */         return(1);
      /*      * Ignore SIGINT and SIGQUIT, block SIGCHLD. Remember to save      * existing signal dispositions.      */     ign.sa_handler = SIG_IGN;     (void)sigemptyset(&ign.sa_mask);     ign.sa_flags = 0;     (void)sigaction(SIGINT, &ign, &intact);     (void)sigaction(SIGQUIT, &ign, &quitact);     (void)sigemptyset(&newsigblock);     (void)sigaddset(&newsigblock, SIGCHLD);     (void)sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock);     switch(pid = fork()) {     case -1:            /* error */         break;     case 0:                /* child */         /*          * Restore original signal dispositions and exec the command.          */         (void)sigaction(SIGINT, &intact, NULL);         (void)sigaction(SIGQUIT,  &quitact, NULL);         (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);         execl(_PATH_BSHELL, "sh", "-c", command, (char *)NULL);         _exit(127);     default:            /* parent */         savedpid = pid;         do {             pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0);         } while (pid == -1 && errno == EINTR);         break;     }     (void)sigaction(SIGINT, &intact, NULL);     (void)sigaction(SIGQUIT,  &quitact, NULL);     (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);     return(pid == -1 ? -1 : pstat); }
  #ifndef _THREAD_SAFE __weak_reference(__system, system); #endif 
       
      
     | 
   
   
  
  Jetzt versteh ich auch warums der autor vereinfacht hat  
  mfg |