0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-04 18:45:52 +00:00
termux-packages/packages/llvm-mingw-w64-tools/0001-do-not-use-posix-spawn.patch
2024-10-05 02:30:06 +08:00

34 lines
858 B
Diff

--- a/mingw-w64-tools/widl/tools.h
+++ b/mingw-w64-tools/widl/tools.h
@@ -57,8 +57,10 @@
# define strcasecmp _stricmp
# endif
#else
+#if !defined(__ANDROID__) || __ANDROID_API__ >= 28
extern char **environ;
# include <spawn.h>
+#endif
# include <sys/wait.h>
# include <unistd.h>
# ifndef O_BINARY
@@ -285,9 +287,19 @@
pid_t pid, wret;
int status;
+#if defined(__ANDROID__) && __ANDROID_API__ < 28
+ if (!(pid = fork()))
+ {
+ strarray_add( &args, NULL );
+ execvp( args.str[0], (char **)args.str );
+ _exit(1);
+ }
+ if (pid == -1) return -1;
+#else
strarray_add( &args, NULL );
if (posix_spawnp( &pid, args.str[0], NULL, NULL, (char **)args.str, environ ))
return -1;
+#endif
while (pid != (wret = waitpid( pid, &status, 0 )))
if (wret == -1 && errno != EINTR) break;