Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.74
 
1.75
 
MAIN:stefan:20071110094445
 
cc.c
_>649649 int
 650650 callsys(char f[], char *v[])
 651651 {
<>652 -        int status;
 653 -        pid_t t;
  652+        int t, status = 0;
  653+        pid_t p;
654654         char *s;
 655655 
 656656         if (vflag) {
     
 !
660660                 fprintf(stderr, "\n");
 661661         }
 662662 
<>663 -        if ((t=fork())==0) {
  663+        if ((p = fork()) == 0) {
664664                 if (Bflag) {
 665665                         size_t len = strlen(Bflag) + 8;
 666666                         char *a = malloc(len);
     
 !
677677                 execv(f, v);
 678678                 if ((s = strrchr(f, '/')))
 679679                         execvp(s+1, v);
<>680 -                printf("Can't find %s\n", f);
 681 -                exit(100);
 682 -        } else
 683 -                if (t == -1) {
  680+                fprintf(stderr, "Can't find %s\n", f);
  681+                _exit(100);
  682+        } else {
  683+                if (p == -1) {
684684                         printf("Try again\n");
 685685                         return(100);
 686686                 }
<>687 -        while(t!=wait(&status));
 688 -        if ((t=(status&0377)) != 0 && t!=14) {
 689 -                if (t!=2)               /* interrupt */
 690 -                        errorx(8, "Fatal error in %s", f);
 691 -                dexit(eflag);
692687         }
<>693 -        return((status>>8) & 0377);
  688+        while (waitpid(p, &status, 0) == -1 && errno == EINTR)
  689+                ;
  690+        if (WIFEXITED(status))
  691+                return (WEXITSTATUS(status));
  692+        if (WIFSIGNALED(status))
  693+                dexit(eflag);
  694+        errorx(8, "Fatal error in %s", f);
<_694695 }
 695696 
 696697 char *
FishEye: Open Source License registered to PCC.
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-12-20 22:37 +0100