git: c901e89d8e46 - main - savecore: add missing call to cap_openlog when in capabilities mode

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 24 Jan 2025 14:36:05 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=c901e89d8e467b56f844ab5dba18dc20d503c2be

commit c901e89d8e467b56f844ab5dba18dc20d503c2be
Author:     Stéphane Rochoy <stephane.rochoy@stormshield.eu>
AuthorDate: 2024-12-11 13:39:36 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2025-01-24 14:20:51 +0000

    savecore: add missing call to cap_openlog when in capabilities mode
    
    Signed-off-by: Stéphane Rochoy <stephane.rochoy@stormshield.eu>
    
    Reviewed by:    markj, oshogbo
    MFC after:      2 weeks
    Pull Request:   https://github.com/freebsd/freebsd-src/pull/1546
---
 sbin/savecore/savecore.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/sbin/savecore/savecore.c b/sbin/savecore/savecore.c
index 5ba7e62e7d6c..2f3ad3adc7ab 100644
--- a/sbin/savecore/savecore.c
+++ b/sbin/savecore/savecore.c
@@ -101,6 +101,9 @@
 #define	STATUS_GOOD	1
 #define	STATUS_UNKNOWN	2
 
+#define LOG_OPTIONS  LOG_PERROR
+#define LOG_FACILITY LOG_DAEMON
+
 static cap_channel_t *capsyslog;
 static fileargs_t *capfa;
 static bool checkfor, compress, uncompress, clear, force, keep;	/* flags */
@@ -1409,6 +1412,7 @@ init_caps(int argc, char **argv)
 		exit(EXIT_FAILURE);
 	}
 	cap_close(capcas);
+	cap_openlog(capsyslog, "savecore", LOG_OPTIONS, LOG_FACILITY);
 }
 
 static void
@@ -1436,7 +1440,7 @@ main(int argc, char **argv)
 	savedir = ".";
 	comp_desired = KERNELDUMP_COMP_NONE;
 
-	openlog("savecore", LOG_PERROR, LOG_DAEMON);
+	openlog("savecore", LOG_OPTIONS, LOG_FACILITY);
 	signal(SIGINFO, infohandler);
 
 	argc = xo_parse_args(argc, argv);