Lines 143-150
Link Here
|
143 |
|
143 |
|
144 |
saved_stderr = fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 3); |
144 |
saved_stderr = fcntl(STDERR_FILENO, F_DUPFD_CLOEXEC, 3); |
145 |
|
145 |
|
146 |
if (dup3(fd, STDOUT_FILENO, 0) < 0 || |
146 |
if (dup2(fd, STDOUT_FILENO) < 0 || |
147 |
dup3(fd, STDERR_FILENO, 0) < 0) { |
147 |
dup2(fd, STDERR_FILENO) < 0) { |
148 |
log_error("Failed to duplicate fd: %m"); |
148 |
log_error("Failed to duplicate fd: %m"); |
149 |
r = -errno; |
149 |
r = -errno; |
150 |
goto finish; |
150 |
goto finish; |
Lines 164-170
Link Here
|
164 |
|
164 |
|
165 |
/* Let's try to restore a working stderr, so we can print the error message */ |
165 |
/* Let's try to restore a working stderr, so we can print the error message */ |
166 |
if (saved_stderr >= 0) |
166 |
if (saved_stderr >= 0) |
167 |
dup3(saved_stderr, STDERR_FILENO, 0); |
167 |
dup2(saved_stderr, STDERR_FILENO); |
168 |
|
168 |
|
169 |
log_error("Failed to execute process: %s", strerror(-r)); |
169 |
log_error("Failed to execute process: %s", strerror(-r)); |
170 |
|
170 |
|