]> git.ipfire.org Git - thirdparty/lldpd.git/commitdiff
daemon/priv: fix ctlname parameter shadowing file-scope global
authorVincent Bernat <vincent@bernat.ch>
Sat, 9 May 2026 12:39:09 +0000 (14:39 +0200)
committerVincent Bernat <vincent@bernat.ch>
Sat, 9 May 2026 13:26:12 +0000 (15:26 +0200)
The local parameter shadowed the static ctlname, so `strdup()` was
assigned to the parameter and the global stayed NULL. As a result,
`asroot_ctl_cleanup()` never cleaned up the registered control socket.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
src/daemon/priv.c

index f84d63aecc56605d89b558dc14ec14ba131235a3..cd1e9da243241ace2921785c23862e6cdca0abda 100644 (file)
@@ -689,14 +689,14 @@ priv_caps(uid_t uid, gid_t gid)
 
 void
 #ifdef ENABLE_PRIVSEP
-priv_init(const char *chrootdir, int ctl, uid_t uid, gid_t gid, const char *ctlname)
+priv_init(const char *chrootdir, int ctl, uid_t uid, gid_t gid, const char *name)
 #else
-priv_init(const char *ctlname)
+priv_init(const char *name)
 #endif
 {
        /* Store the expected control socket path for asroot_ctl_cleanup() */
-       if (ctlname) {
-               ctlname = strdup(ctlname);
+       if (name) {
+               ctlname = strdup(name);
                if (ctlname == NULL) fatal("privsep", NULL);
        }