aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-07-03 15:04:51 +0000
committerNick Mathewson <nickm@torproject.org>2008-07-03 15:04:51 +0000
commita0404dad391e1bdd5a34a2a260f433c40605959f (patch)
treeaf50b4c5948d18ef98685b462c9560b4c448e04d
parent34037399696685cd58789cdf6939ae27e9a33ab9 (diff)
downloadtor-a0404dad391e1bdd5a34a2a260f433c40605959f.tar.gz
tor-a0404dad391e1bdd5a34a2a260f433c40605959f.zip
r16691@tombo: nickm | 2008-07-03 11:04:03 -0400
Backport to 0.1.2: Fix for bug 742: do not use O_CREAT on 2-option version of open(). Especially do not use it on /dev/null. Fix from Michael Scherer. Bugfix on 0.0.2pre19 (wow). svn:r15628
-rw-r--r--ChangeLog3
-rw-r--r--src/common/util.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index fd7764235f..8177fac0a9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,9 @@ Changes in version 0.1.2.20 - 2008-??-??
- Fix a dumb bug that was preventing us from knowing that we should
preemptively build circuits to handle expected directory requests.
Fixes bug 660.
+ - When opening /dev/null in finish_daemonize(), do not pass the
+ O_CREAT flag. Fortify was complaining, and correctly so. Fixes
+ bug 742; fix from Michael Scherer. Bugfix on 0.0.2pre19.
o Minor testing features:
- Add disabled-by-default code to log the relative probability of routing
diff --git a/src/common/util.c b/src/common/util.c
index ee9854f1c7..3f172e84bf 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -2070,8 +2070,7 @@ finish_daemon(const char *desired_cwd)
exit(1);
}
- nullfd = open("/dev/null",
- O_CREAT | O_RDWR | O_APPEND);
+ nullfd = open("/dev/null", O_RDWR | O_APPEND);
if (nullfd < 0) {
log_err(LD_GENERAL,"/dev/null can't be opened. Exiting.");
exit(1);