aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-12-24 08:27:33 +0000
committerUlrich Drepper <drepper@redhat.com>1999-12-24 08:27:33 +0000
commitce40141c6b68a40687f460450e1d07a0a78e1559 (patch)
tree628edaa451b15d76951e10cf9d8e082a26a3806a /sysdeps/posix
parent293321753c08b5db20b866f2ae2dbd716f717434 (diff)
downloadglibc-ce40141c6b68a40687f460450e1d07a0a78e1559.zip
glibc-ce40141c6b68a40687f460450e1d07a0a78e1559.tar.gz
glibc-ce40141c6b68a40687f460450e1d07a0a78e1559.tar.bz2
Update.
1999-12-24 Ulrich Drepper <drepper@cygnus.com> * sysdeps/posix/system.c (__libc_system): Check whether command processor is available if LINE is NULL. Don't return immediately if wait call returned with EINTR. Patches by Geoff Clare <gwc@unisoft.com> (PR libc/1497 and libc/1498).
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/system.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/sysdeps/posix/system.c b/sysdeps/posix/system.c
index 1111646..10c86a9 100644
--- a/sysdeps/posix/system.c
+++ b/sysdeps/posix/system.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97, 99 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -44,8 +44,9 @@ __libc_system (const char *line)
#endif
if (line == NULL)
- /* This signals that we have a command processor available. */
- return 1;
+ /* Check that we have a command processor available. It might
+ not be available after a chroot(), for example. */
+ return __libc_system ("exit 0");
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
@@ -113,23 +114,32 @@ __libc_system (const char *line)
status = -1;
else
/* Parent side. */
-#ifdef NO_WAITPID
{
+#ifdef NO_WAITPID
pid_t child;
do
{
child = __wait (&status);
- if (child <= -1)
+ if (child <= -1 && errno != EINTR)
{
status = -1;
break;
}
- } while (child != pid);
- }
+ /* Note that pid cannot be <= -1 and therefore the loop continues
+ when __wait returned with EINTR. */
+ }
+ while (child != pid);
#else
- if (__waitpid (pid, &status, 0) != pid)
- status = -1;
+ int n;
+
+ do
+ n = __waitpid (pid, &status, 0);
+ while (n == -1 && errno == EINTR);
+
+ if (n != pid)
+ status = -1;
#endif
+ }
save = errno;
if ((__sigaction (SIGINT, &intr, (struct sigaction *) NULL) |