mirror of
https://github.com/NikitaIvanovV/ctpv.git
synced 2024-11-28 07:23:07 +01:00
Allow passing NULL as fds
This commit is contained in:
parent
8487750f1a
commit
1f460e2de1
2
utils.c
2
utils.c
@ -28,6 +28,7 @@ int spawn(char *args[], pid_t *cpid, int *exitcode, int *fds[2])
|
|||||||
|
|
||||||
/* Child process */
|
/* Child process */
|
||||||
if (pid == 0) {
|
if (pid == 0) {
|
||||||
|
if (fds) {
|
||||||
while (*fds) {
|
while (*fds) {
|
||||||
if (dup2((*fds)[0], (*fds)[1]) == -1) {
|
if (dup2((*fds)[0], (*fds)[1]) == -1) {
|
||||||
print_errorf("dup2() failed: %s", strerror(errno));
|
print_errorf("dup2() failed: %s", strerror(errno));
|
||||||
@ -35,6 +36,7 @@ int spawn(char *args[], pid_t *cpid, int *exitcode, int *fds[2])
|
|||||||
}
|
}
|
||||||
fds = &fds[1];
|
fds = &fds[1];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
execvp(args[0], args);
|
execvp(args[0], args);
|
||||||
print_errorf("exec() failed: %s", strerror(errno));
|
print_errorf("exec() failed: %s", strerror(errno));
|
||||||
|
Loading…
Reference in New Issue
Block a user