From 999b2f6bd7c194dff96e323fffbbe59564bfc1ee Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 29 Sep 1998 22:42:30 +0000 Subject: Update. 1998-09-29 Thorsten Kukuk * nis/ypclnt.c (yp_all): Close UDP socket und give CLIENT handle free. 1998-09-29 Cristian Gafton * sysdeps/unix/sysv/linux/alpha/ioperm.c: List Ruffian in platforms[]. * sysdeps/unix/sysv/linux/net/if_shaper.h: New file. * sysdeps/unix/sysv/linux/Dist: Add net/if_shaper.h. * sysdeps/unix/sysv/linux/Makefile [subdirs=inet] (sysdep_headers): Add net/if_shaper.h. * libio/libio.h [!__STDC__]: Define const only if not defined. --- posix/annexc.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'posix') diff --git a/posix/annexc.c b/posix/annexc.c index 56af0a5..e9e1ac9 100644 --- a/posix/annexc.c +++ b/posix/annexc.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #define TMPFILE "/tmp/macros" #define HEADER_MAX 256 @@ -629,6 +631,7 @@ const char *INC; static char *xstrndup (const char *, size_t); static const char **get_null_defines (void); static int check_header (const struct header *, const char **); +static int xsystem (const char *); int main (int argc, char *argv[]) @@ -674,6 +677,31 @@ xstrndup (const char *s, size_t n) } +/* Like system but propagate interrupt and quit signals. */ +int +xsystem (const char *cmd) +{ + int status; + + status = system (cmd); + if (status != -1) + { + if (WIFSIGNALED (status)) + { + if (WTERMSIG (status) == SIGINT || WTERMSIG (status) == SIGQUIT) + raise (WTERMSIG (status)); + } + else if (WIFEXITED (status)) + { + if (WEXITSTATUS (status) == SIGINT + 128 + || WEXITSTATUS (status) == SIGQUIT + 128) + raise (WEXITSTATUS (status) - 128); + } + } + return status; +} + + static const char ** get_null_defines (void) { @@ -695,7 +723,7 @@ get_null_defines (void) sprintf (command, fmt, "/dev/null", CC, INC, CC, TMPFILE); - if (system (command)) + if (xsystem (command)) { puts ("system() returned nonzero"); return NULL; @@ -787,14 +815,14 @@ check_header (const struct header *header, const char **except) if (header->subset != NULL) { sprintf (line, testfmt, header->subset, CC, INC, CC, TMPFILE); - if (system (line)) + if (xsystem (line)) { printf ("!! not available\n"); return 0; } } - if (system (command)) + if (xsystem (command)) { puts ("system() returned nonzero"); result = 1; -- cgit v1.1