(do_system): Minor optimizations. Remove unnecessary code.

This commit is contained in:
Ulrich Drepper 2003-01-04 22:37:17 +00:00
parent fd4b70ea80
commit 71302f5f86

View File

@ -64,9 +64,7 @@ do_system (const char *line)
#ifndef _LIBC_REENTRANT #ifndef _LIBC_REENTRANT
struct sigaction intr, quit; struct sigaction intr, quit;
#endif #endif
#ifndef WAITPID_CANNOT_BLOCK_SIGCHLD sigset_t omask;
sigset_t block, omask;
#endif
sa.sa_handler = SIG_IGN; sa.sa_handler = SIG_IGN;
sa.sa_flags = 0; sa.sa_flags = 0;
@ -78,8 +76,7 @@ do_system (const char *line)
if (__sigaction (SIGINT, &sa, &intr) < 0) if (__sigaction (SIGINT, &sa, &intr) < 0)
{ {
SUB_REF (); SUB_REF ();
DO_UNLOCK (); goto out;
return -1;
} }
if (__sigaction (SIGQUIT, &sa, &quit) < 0) if (__sigaction (SIGQUIT, &sa, &quit) < 0)
{ {
@ -90,25 +87,28 @@ do_system (const char *line)
} }
DO_UNLOCK (); DO_UNLOCK ();
__sigemptyset (&block); /* We reuse the bitmap in the 'sa' structure. */
__sigaddset (&block, SIGCHLD); __sigaddset (&sa.sa_mask, SIGCHLD);
save = errno; save = errno;
if (__sigprocmask (SIG_BLOCK, &block, &omask) < 0) if (__sigprocmask (SIG_BLOCK, &sa.sa_mask, &omask) < 0)
{ {
#ifndef _LIBC
if (errno == ENOSYS) if (errno == ENOSYS)
__set_errno (save); __set_errno (save);
else else
#endif
{ {
save = errno;
DO_LOCK (); DO_LOCK ();
if (SUB_REF () == 0) if (SUB_REF () == 0)
{ {
save = errno;
(void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL); (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
out_restore_sigint: out_restore_sigint:
(void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL); (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
__set_errno (save);
} }
out:
DO_UNLOCK (); DO_UNLOCK ();
__set_errno (save);
return -1; return -1;
} }
} }