aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSeebs <seebs@seebs.net>2016-09-28 22:12:29 -0500
committerSeebs <seebs@seebs.net>2016-09-28 22:12:29 -0500
commit7a0632cad851826d804db0540d9a59773e6bf29c (patch)
tree7c554e3772b7e59ce56bf3228e640f0a4dceb9f0
parenteead8a505245a292c43f070c0e836cdfeb7bd7bd (diff)
downloadpseudo-7a0632cad851826d804db0540d9a59773e6bf29c.tar.gz
pseudo-7a0632cad851826d804db0540d9a59773e6bf29c.tar.bz2
pseudo-7a0632cad851826d804db0540d9a59773e6bf29c.zip
Use correct file descriptor
So it turns out that pseudo_logfile() was returning 0 or -1, and pseudo_debug_logfile() was expecting it to be the correct file descriptor to use. And it's basically a mystery that any of that ever worked. Signed-off-by: Seebs <seebs@seebs.net>
-rw-r--r--ChangeLog.txt3
-rw-r--r--pseudo_util.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 1ae6abd..65b9759 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -2,6 +2,9 @@
* (seebs) Send errors to log when daemonizing, but do that a lot
sooner to prevent startup messages which can show up spuriously
with multiple clients.
+ * (seebs) return file descriptor from pseudo_logfile, so we set
+ pseudo_util_debug_fd to the right value instead of to stdin.
+ Nice bug.
2016-09-22:
* (seebs) don't send SIGUSR1 to init.
diff --git a/pseudo_util.c b/pseudo_util.c
index 0c156cf..a60c74b 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -1569,7 +1569,7 @@ pseudo_logfile(char *filename, char *defname, int prefer_fd) {
if (fd == -1)
return -1;
else
- return 0;
+ return fd;
}
int
@@ -1579,6 +1579,7 @@ pseudo_debug_logfile(char *defname, int prefer_fd) {
fd = pseudo_logfile(filename, defname, prefer_fd);
if (fd > -1) {
+ pseudo_diag("debug_logfile: fd %d\n", fd);
pseudo_util_debug_fd = fd;
return 0;
}