diff options
author | Christian Grothoff <christian@grothoff.org> | 2010-08-14 21:36:08 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2010-08-14 21:36:08 +0000 |
commit | 874a73c6e814da43fdc895112a74b01c212e02f6 (patch) | |
tree | 38852736a2899a918ed09f19eda8e5987eed94cc /src/util/service.c | |
parent | b743a6e58d71e5ba84704c047b5fd695390cdde6 (diff) | |
download | gnunet-874a73c6e814da43fdc895112a74b01c212e02f6.tar.gz gnunet-874a73c6e814da43fdc895112a74b01c212e02f6.zip |
do not leak nullfd
Diffstat (limited to 'src/util/service.c')
-rw-r--r-- | src/util/service.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/service.c b/src/util/service.c index 21841dd49..df5342c1d 100644 --- a/src/util/service.c +++ b/src/util/service.c | |||
@@ -1415,10 +1415,12 @@ detach_terminal (struct GNUNET_SERVICE_Context *sctx) | |||
1415 | return GNUNET_SYSERR; | 1415 | return GNUNET_SYSERR; |
1416 | /* set stdin/stdout to /dev/null */ | 1416 | /* set stdin/stdout to /dev/null */ |
1417 | if ((dup2 (nullfd, 0) < 0) || (dup2 (nullfd, 1) < 0)) | 1417 | if ((dup2 (nullfd, 0) < 0) || (dup2 (nullfd, 1) < 0)) |
1418 | { | 1418 | { |
1419 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "dup2"); | 1419 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "dup2"); |
1420 | (void) CLOSE (nullfd); | ||
1420 | return GNUNET_SYSERR; | 1421 | return GNUNET_SYSERR; |
1421 | } | 1422 | } |
1423 | (void) CLOSE (nullfd); | ||
1422 | /* Detach from controlling terminal */ | 1424 | /* Detach from controlling terminal */ |
1423 | pid = setsid (); | 1425 | pid = setsid (); |
1424 | if (pid == -1) | 1426 | if (pid == -1) |