diff -ur Libc-1272.200.26/stdlib/FreeBSD/system.c Libc-1272.200.26+iPhone/stdlib/FreeBSD/system.c --- Libc-1272.200.26/stdlib/FreeBSD/system.c 2018-03-22 07:37:55.000000000 -1000 +++ Libc-1272.200.26+iPhone/stdlib/FreeBSD/system.c 2019-05-01 23:27:20.000000000 -1000 @@ -57,20 +57,14 @@ #if __DARWIN_UNIX03 #include -#if !(TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS)) static pthread_mutex_t __systemfn_mutex = PTHREAD_MUTEX_INITIALIZER; -#endif extern int __unix_conforming; #endif /* __DARWIN_UNIX03 */ int -__system(command) +system(command) const char *command; { -#if TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS) - // Don't abort() on iOS for now - LIBC_ABORT("system() is not supported on this platform."); -#else pid_t pid, savedpid; int pstat, err; struct sigaction ign, intact, quitact; @@ -88,14 +82,10 @@ #endif /* __DARWIN_UNIX03 */ if (!command) { /* just checking... */ -#if TARGET_OS_IPHONE - return(0); -#else if (access(_PATH_BSHELL, F_OK) == -1) /* if no sh or no access */ return(0); else return(1); -#endif } if ((err = posix_spawnattr_init(&attr)) != 0) { @@ -114,19 +104,19 @@ ign.sa_handler = SIG_IGN; (void)sigemptyset(&ign.sa_mask); ign.sa_flags = 0; - (void)_sigaction(SIGINT, &ign, &intact); + (void)sigaction(SIGINT, &ign, &intact); if (intact.sa_handler != SIG_IGN) { sigaddset(&defaultsig, SIGINT); flags |= POSIX_SPAWN_SETSIGDEF; } - (void)_sigaction(SIGQUIT, &ign, &quitact); + (void)sigaction(SIGQUIT, &ign, &quitact); if (quitact.sa_handler != SIG_IGN) { sigaddset(&defaultsig, SIGQUIT); flags |= POSIX_SPAWN_SETSIGDEF; } (void)sigemptyset(&newsigblock); (void)sigaddset(&newsigblock, SIGCHLD); - (void)_sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); + (void)sigprocmask(SIG_BLOCK, &newsigblock, &oldsigblock); (void)posix_spawnattr_setsigmask(&attr, &oldsigblock); if (flags & POSIX_SPAWN_SETSIGDEF) { (void)posix_spawnattr_setsigdefault(&attr, &defaultsig); @@ -138,7 +128,7 @@ if (err == 0) { savedpid = pid; do { - pid = _wait4(savedpid, &pstat, 0, (struct rusage *)0); + pid = wait4(savedpid, &pstat, 0, (struct rusage *)0); } while (pid == -1 && errno == EINTR); if (pid == -1) pstat = -1; } else if (err == ENOMEM || err == EAGAIN) { /* as if fork failed */ @@ -147,17 +137,14 @@ pstat = W_EXITCODE(127, 0); /* couldn't exec shell */ } - (void)_sigaction(SIGINT, &intact, NULL); - (void)_sigaction(SIGQUIT, &quitact, NULL); - (void)_sigprocmask(SIG_SETMASK, &oldsigblock, NULL); + (void)sigaction(SIGINT, &intact, NULL); + (void)sigaction(SIGQUIT, &quitact, NULL); + (void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL); #if __DARWIN_UNIX03 pthread_mutex_unlock(&__systemfn_mutex); #endif /* __DARWIN_UNIX03 */ return(pstat); -#endif /* TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS) */ } -__weak_reference(__system, system); -__weak_reference(__system, _system); #pragma clang diagnostic pop