]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
logerr: use LOG_NDELAY for openlog
authorRoy Marples <roy@marples.name>
Thu, 31 Oct 2024 10:40:46 +0000 (10:40 +0000)
committerRoy Marples <roy@marples.name>
Thu, 31 Oct 2024 10:40:46 +0000 (10:40 +0000)
This ensures openlog gets a fd so logging of errors can occur
within privsep where no log was written before entering privsep.
Also ensures that closelog does not close -1 on some platforms
where no logging took place.

src/logerr.c

index fef33deadf857fa6614925d0b700a28704d4e0c9..3e5cd835e936f45fe35b7b224553ff6522a6104a 100644 (file)
@@ -447,7 +447,7 @@ int
 logopen(const char *path)
 {
        struct logctx *ctx = &_logctx;
-       int opts = 0;
+       int opts = LOG_NDELAY; /* Ensure openlog gets a fd */
 
        /* Cache timezone */
        tzset();