Use _spawnvp to replace fork for non-Unix platforms.
This commit is contained in:
parent
5577637034
commit
c45bbad3d6
|
@ -13246,6 +13246,7 @@ fi
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
for ac_func in \
|
||||
|
@ -13253,6 +13254,7 @@ for ac_func in \
|
|||
_pclose \
|
||||
_popen \
|
||||
_snprintf \
|
||||
_spawnvp \
|
||||
_stricmp \
|
||||
_strnicmp \
|
||||
_vsnprintf \
|
||||
|
|
|
@ -946,6 +946,7 @@ AC_CHECK_FUNCS(\
|
|||
_pclose \
|
||||
_popen \
|
||||
_snprintf \
|
||||
_spawnvp \
|
||||
_stricmp \
|
||||
_strnicmp \
|
||||
_vsnprintf \
|
||||
|
|
|
@ -686,6 +686,9 @@
|
|||
/* Define to 1 if you have the `_snprintf' function. */
|
||||
#undef HAVE__SNPRINTF
|
||||
|
||||
/* Define to 1 if you have the `_spawnvp' function. */
|
||||
#undef HAVE__SPAWNVP
|
||||
|
||||
/* Define to 1 if you have the `_stricmp' function. */
|
||||
#undef HAVE__STRICMP
|
||||
|
||||
|
|
|
@ -75,6 +75,9 @@ char *strmake(const char *fmt, ...)
|
|||
|
||||
void spawn(char *const argv[])
|
||||
{
|
||||
#ifdef HAVE__SPAWNVP
|
||||
if (!_spawnvp( _P_WAIT, argv[0], argv)) return;
|
||||
#else
|
||||
int pid, status, wret, i;
|
||||
|
||||
if (verbose)
|
||||
|
@ -92,6 +95,8 @@ void spawn(char *const argv[])
|
|||
if (pid == wret && WIFEXITED(status) && WEXITSTATUS(status) == 0) return;
|
||||
error("%s failed.", argv[0]);
|
||||
}
|
||||
#endif /* HAVE__SPAWNVP */
|
||||
|
||||
perror("Error:");
|
||||
exit(3);
|
||||
}
|
||||
|
|
|
@ -296,6 +296,9 @@ void create_file(const char *name, const char *fmt, ...)
|
|||
|
||||
void spawn(char *const argv[])
|
||||
{
|
||||
#ifdef HAVE__SPAWNVP
|
||||
if (!_spawnvp( _P_WAIT, argv[0], argv)) return;
|
||||
#else
|
||||
int pid, status, wret, i;
|
||||
|
||||
if (verbose)
|
||||
|
@ -313,6 +316,8 @@ void spawn(char *const argv[])
|
|||
if (pid == wret && WIFEXITED(status) && WEXITSTATUS(status) == 0) return;
|
||||
error("%s failed.", argv[0]);
|
||||
}
|
||||
#endif /* HAVE__SPAWNVP */
|
||||
|
||||
perror("Error:");
|
||||
exit(3);
|
||||
}
|
||||
|
@ -675,7 +680,7 @@ int main(int argc, char **argv)
|
|||
|
||||
/* create the loader script */
|
||||
create_file(base_file, app_loader_script, base_name);
|
||||
chmod(base_file, S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
|
||||
chmod(base_file, 0755);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue