1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-15 07:33:25 +00:00

Socat exited with status 0 even when a program invoked with SYSTEM or EXEC failed

This commit is contained in:
Gerhard Rieger 2016-07-29 15:58:59 +02:00
parent 35a7817e48
commit 35590e3cdb
4 changed files with 91 additions and 7 deletions

View file

@ -61,12 +61,14 @@ static int xioopen_system(int argc, const char *argv[], struct opt *opts,
Dup2(duptostderr, 2);
}
Info1("executing shell command \"%s\"", string);
errno=0;
result = System(string);
if (result != 0) {
Warn2("system(\"%s\") returned with status %d", string, result);
Warn1("system(): %s", strerror(errno));
if (errno != 0)
Warn1("system(): %s", strerror(errno));
}
Exit(0); /* this child process */
Exit(result>>8); /* this child process */
}
/* parent */