about summary refs log tree commit diff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--daemon.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/daemon.c b/daemon.c
index a1be594..785504f 100644
--- a/daemon.c
+++ b/daemon.c
@@ -265,13 +265,13 @@ int main(int argc, char *argv[]) {
 		warn("%s", fifoPath);
 	}
 
-	// XXX: Make sure there is always at least one writer open, otherwise we
-	// get EOF continually.
-	int fifo = open(fifoPath, O_RDWR | O_NONBLOCK | O_CLOEXEC);
-	if (fifo < 0) err(EX_CANTCREAT, "%s", fifoPath);
 	struct Line fifoLine = {0};
+	int fifo = open(fifoPath, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
+	if (fifo < 0) err(EX_CANTCREAT, "%s", fifoPath);
 
-	openlog(getprogname(), LOG_NDELAY | LOG_PID | LOG_PERROR, LOG_DAEMON);
+	// XXX: Keep a writer open so the reader never gets EOF.
+	int writer = open(fifoPath, O_WRONLY | O_NONBLOCK | O_CLOEXEC);
+	if (writer < 0) err(EX_CANTCREAT, "%s", fifoPath);
 
 	error = parseConfig(configPath);
 	if (error) return EX_DATAERR;