git: 1af1fbeb424d - stable/14 - logger: Close syslog channel on exit
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 15 Nov 2026 17:28:43 UTC
The branch stable/14 has been updated by des:
URL: https://cgit.FreeBSD.org/src/commit/?id=1af1fbeb424ddd8786ac0ef60d4ad2343f2736f2
commit 1af1fbeb424ddd8786ac0ef60d4ad2343f2736f2
Author: Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2026-11-04 15:32:24 +0000
Commit: Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2026-11-14 15:49:23 +0000
logger: Close syslog channel on exit
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: Qualys, Inc.
Reviewed by: oshogbo
Differential Revision: https://reviews.freebsd.org/D60170
(cherry picked from commit aa00f4c4f69f7cd7c3ccb7e4371a44bd338cc812)
---
usr.bin/logger/logger.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/usr.bin/logger/logger.c b/usr.bin/logger/logger.c
index 18292010c7ca..78c657f66422 100644
--- a/usr.bin/logger/logger.c
+++ b/usr.bin/logger/logger.c
@@ -77,6 +77,7 @@ static ssize_t socksetup(const char *, const char *, const char *,
struct socks **);
static void logmessage(int, const char *, const char *, const char *,
struct socks *, ssize_t, const char *);
+static void closesyslog(void);
static void usage(void);
static cap_channel_t *capsyslog;
@@ -187,6 +188,7 @@ main(int argc, char *argv[])
if (capsyslog == NULL)
err(1, "Unable to open system.syslog service");
cap_close(capcas);
+ atexit(closesyslog);
if (pristr != NULL)
pri = pencode(pristr);
@@ -442,6 +444,12 @@ decode(char *name, const CODE *codetab)
return (-1);
}
+static void
+closesyslog(void)
+{
+ cap_close(capsyslog);
+}
+
static void
usage(void)
{