aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-08-21 10:38:19 -0400
committerNick Mathewson <nickm@torproject.org>2014-08-21 10:38:19 -0400
commit0de7565dfd4498e9bbc2ab295e5b160bab6e1867 (patch)
tree1f45bfdb1cc4187852b60583ad7eb10e4d89294d /src
parent377b5c0510478994fccc4c8931cbce136eb41a5b (diff)
downloadtor-0de7565dfd4498e9bbc2ab295e5b160bab6e1867.tar.gz
tor-0de7565dfd4498e9bbc2ab295e5b160bab6e1867.zip
Check return values for fcntl in tor_spawn_background.
[CID 718609]
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 4029512978..16ff8e3a80 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -4052,8 +4052,11 @@ tor_spawn_background(const char *const filename, const char **argv,
status = process_handle->status = PROCESS_STATUS_RUNNING;
/* Set stdout/stderr pipes to be non-blocking */
- fcntl(process_handle->stdout_pipe, F_SETFL, O_NONBLOCK);
- fcntl(process_handle->stderr_pipe, F_SETFL, O_NONBLOCK);
+ if (fcntl(process_handle->stdout_pipe, F_SETFL, O_NONBLOCK) < 0 ||
+ fcntl(process_handle->stderr_pipe, F_SETFL, O_NONBLOCK) < 0) {
+ log_warn(LD_GENERAL, "Failed to set stderror/stdout pipes nonblocking "
+ "in parent process: %s", strerror(errno));
+ }
/* Open the buffered IO streams */
process_handle->stdout_handle = fdopen(process_handle->stdout_pipe, "r");
process_handle->stderr_handle = fdopen(process_handle->stderr_pipe, "r");