os: utils: drop obsolete System() on non-win32 targets
This function is only used on WIN32 targets, so we can drop the *nix implementation. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net> Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1295>
This commit is contained in:
parent
0acba54e54
commit
5d2f675ca8
|
@ -332,8 +332,6 @@ OsAbort(void)
|
|||
_X_NORETURN;
|
||||
|
||||
#if !defined(WIN32)
|
||||
extern _X_EXPORT int
|
||||
System(const char *);
|
||||
extern _X_EXPORT void *
|
||||
Popen(const char *, const char *);
|
||||
extern _X_EXPORT int
|
||||
|
|
43
os/utils.c
43
os/utils.c
|
@ -1297,49 +1297,6 @@ OsAbort(void)
|
|||
* as well. As it is now, xkbcomp messages don't end up in the log file.
|
||||
*/
|
||||
|
||||
int
|
||||
System(const char *command)
|
||||
{
|
||||
int pid, p;
|
||||
void (*csig) (int);
|
||||
int status;
|
||||
|
||||
if (!command)
|
||||
return 1;
|
||||
|
||||
csig = OsSignal(SIGCHLD, SIG_DFL);
|
||||
if (csig == SIG_ERR) {
|
||||
perror("signal");
|
||||
return -1;
|
||||
}
|
||||
DebugF("System: `%s'\n", command);
|
||||
|
||||
switch (pid = fork()) {
|
||||
case -1: /* error */
|
||||
p = -1;
|
||||
break;
|
||||
case 0: /* child */
|
||||
if (setgid(getgid()) == -1)
|
||||
_exit(127);
|
||||
if (setuid(getuid()) == -1)
|
||||
_exit(127);
|
||||
execl("/bin/sh", "sh", "-c", command, (char *) NULL);
|
||||
_exit(127);
|
||||
default: /* parent */
|
||||
do {
|
||||
p = waitpid(pid, &status, 0);
|
||||
} while (p == -1 && errno == EINTR);
|
||||
|
||||
}
|
||||
|
||||
if (OsSignal(SIGCHLD, csig) == SIG_ERR) {
|
||||
perror("signal");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return p == -1 ? -1 : status;
|
||||
}
|
||||
|
||||
static struct pid {
|
||||
struct pid *next;
|
||||
FILE *fp;
|
||||
|
|
Loading…
Reference in New Issue