From 1e4378ea06d06f57027a97714f076ad4f417a705 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Tue, 25 Feb 2014 15:19:26 -0800 Subject: [PATCH] Switch to current OpenBSD system.c. Change-Id: Ie2df60f0d55dca69149ffe064f10183411407987 --- libc/Android.mk | 2 +- .../lib/libc/stdlib}/system.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) rename libc/{unistd => upstream-openbsd/lib/libc/stdlib}/system.c (92%) diff --git a/libc/Android.mk b/libc/Android.mk index 9ab7e8e24..e401a1c2c 100644 --- a/libc/Android.mk +++ b/libc/Android.mk @@ -106,7 +106,6 @@ libc_common_src_files := \ stdlib/strtod.c \ unistd/alarm.c \ unistd/syslog.c \ - unistd/system.c \ unistd/time.c \ # Fortify implementations of libc functions. @@ -388,6 +387,7 @@ libc_upstream_openbsd_src_files := \ upstream-openbsd/lib/libc/stdlib/strtoumax.c \ upstream-openbsd/lib/libc/stdlib/strtoll.c \ upstream-openbsd/lib/libc/stdlib/strtol.c \ + upstream-openbsd/lib/libc/stdlib/system.c \ upstream-openbsd/lib/libc/locale/wcsxfrm.c \ libc_arch_static_src_files := \ diff --git a/libc/unistd/system.c b/libc/upstream-openbsd/lib/libc/stdlib/system.c similarity index 92% rename from libc/unistd/system.c rename to libc/upstream-openbsd/lib/libc/stdlib/system.c index 72cc37e41..14ddcae8d 100644 --- a/libc/unistd/system.c +++ b/libc/upstream-openbsd/lib/libc/stdlib/system.c @@ -29,18 +29,18 @@ */ #include +#include #include #include #include #include -#include extern char **environ; int system(const char *command) { - pid_t pid; + pid_t pid; sig_t intsave, quitsave; sigset_t mask, omask; int pstat; @@ -61,14 +61,14 @@ system(const char *command) case 0: /* child */ sigprocmask(SIG_SETMASK, &omask, NULL); execve(_PATH_BSHELL, argp, environ); - _exit(127); - } + _exit(127); + } - intsave = (sig_t) bsd_signal(SIGINT, SIG_IGN); - quitsave = (sig_t) bsd_signal(SIGQUIT, SIG_IGN); + intsave = signal(SIGINT, SIG_IGN); + quitsave = signal(SIGQUIT, SIG_IGN); pid = waitpid(pid, (int *)&pstat, 0); sigprocmask(SIG_SETMASK, &omask, NULL); - (void)bsd_signal(SIGINT, intsave); - (void)bsd_signal(SIGQUIT, quitsave); + (void)signal(SIGINT, intsave); + (void)signal(SIGQUIT, quitsave); return (pid == -1 ? -1 : pstat); }