Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 205149
Collapse All | Expand All

(-)os/utils.c (-5 / +21 lines)
Lines 285-291 Link Here
285
	sigaddset(&act.sa_mask, sig);
285
	sigaddset(&act.sa_mask, sig);
286
    act.sa_flags = 0;
286
    act.sa_flags = 0;
287
    act.sa_handler = handler;
287
    act.sa_handler = handler;
288
    sigaction(sig, &act, &oact);
288
    if (sigaction(sig, &act, &oact))
289
      perror("sigaction");
289
    return oact.sa_handler;
290
    return oact.sa_handler;
290
#endif
291
#endif
291
}
292
}
Lines 1684-1689 Link Here
1684
1685
1685
#ifdef SIGCHLD
1686
#ifdef SIGCHLD
1686
    csig = signal(SIGCHLD, SIG_DFL);
1687
    csig = signal(SIGCHLD, SIG_DFL);
1688
    if (csig == SIG_ERR) {
1689
      perror("signal");
1690
      return -1;
1691
    }
1687
#endif
1692
#endif
1688
1693
1689
#ifdef DEBUG
1694
#ifdef DEBUG
Lines 1708-1714 Link Here
1708
    }
1713
    }
1709
1714
1710
#ifdef SIGCHLD
1715
#ifdef SIGCHLD
1711
    signal(SIGCHLD, csig);
1716
    if (signal(SIGCHLD, csig) == SIG_ERR) {
1717
      perror("signal");
1718
      return -1;
1719
    }
1712
#endif
1720
#endif
1713
1721
1714
    return p == -1 ? -1 : status;
1722
    return p == -1 ? -1 : status;
Lines 1720-1726 Link Here
1720
    int pid;
1728
    int pid;
1721
} *pidlist;
1729
} *pidlist;
1722
1730
1723
static sighandler_t old_alarm = NULL; /* XXX horrible awful hack */
1731
void (*old_alarm)(int) = NULL; /* XXX horrible awful hack */
1724
1732
1725
pointer
1733
pointer
1726
Popen(char *command, char *type)
1734
Popen(char *command, char *type)
Lines 1745-1757 Link Here
1745
1753
1746
    /* Ignore the smart scheduler while this is going on */
1754
    /* Ignore the smart scheduler while this is going on */
1747
    old_alarm = signal(SIGALRM, SIG_IGN);
1755
    old_alarm = signal(SIGALRM, SIG_IGN);
1756
    if (old_alarm == SIG_ERR) {
1757
      perror("signal");
1758
      return NULL;
1759
    }
1748
1760
1749
    switch (pid = fork()) {
1761
    switch (pid = fork()) {
1750
    case -1: 	/* error */
1762
    case -1: 	/* error */
1751
	close(pdes[0]);
1763
	close(pdes[0]);
1752
	close(pdes[1]);
1764
	close(pdes[1]);
1753
	xfree(cur);
1765
	xfree(cur);
1754
	signal(SIGALRM, old_alarm);
1766
	if (signal(SIGALRM, old_alarm) == SIG_ERR)
1767
	  perror("signal");
1755
	return NULL;
1768
	return NULL;
1756
    case 0:	/* child */
1769
    case 0:	/* child */
1757
	if (setgid(getgid()) == -1)
1770
	if (setgid(getgid()) == -1)
Lines 1927-1933 Link Here
1927
    /* allow EINTR again */
1940
    /* allow EINTR again */
1928
    OsReleaseSignals ();
1941
    OsReleaseSignals ();
1929
    
1942
    
1930
    signal(SIGALRM, old_alarm);
1943
    if (old_alarm && signal(SIGALRM, old_alarm) == SIG_ERR) {
1944
      perror("signal");
1945
      return -1;
1946
    }
1931
1947
1932
    return pid == -1 ? -1 : pstat;
1948
    return pid == -1 ? -1 : pstat;
1933
}
1949
}

Return to bug 205149