X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/6465356a983ac139f81d3b7913cdb548477c346c..fc56b708803d28b949a9181528bb0da4d25b3b7b:/stdlib/FreeBSD/system.c diff --git a/stdlib/FreeBSD/system.c b/stdlib/FreeBSD/system.c index 3e99468..8ab1eca 100644 --- a/stdlib/FreeBSD/system.c +++ b/stdlib/FreeBSD/system.c @@ -27,6 +27,9 @@ * SUCH DAMAGE. */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wstrict-prototypes" + #if defined(LIBC_SCCS) && !defined(lint) static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ @@ -49,10 +52,14 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/system.c,v 1.11 2007/01/09 00:28:10 imp #include #define environ (*_NSGetEnviron()) +#include + #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 */ @@ -60,6 +67,10 @@ int __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; @@ -77,10 +88,14 @@ __system(command) #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) { @@ -139,7 +154,10 @@ __system(command) 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