From 8c69002b45bbb23764dc9a6a2c2ce8f9275717d4 Mon Sep 17 00:00:00 2001 From: John Lindgren Date: Mon, 8 Mar 2021 12:06:47 -0500 Subject: [PATCH] Eliminate unused arguments to priv_init() with --disable-privsep. This seems a bit cleaner than passing dummy values (e.g. 0) that aren't ever used. Additionally, it means that PRIVSEP_CHROOT no longer needs to be defined to a dummy value if building with --disable-privsep. --- src/daemon/lldpd.c | 2 +- src/daemon/lldpd.h | 4 ++++ src/daemon/priv.c | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/daemon/lldpd.c b/src/daemon/lldpd.c index db4e24a5..5dd2413a 100644 --- a/src/daemon/lldpd.c +++ b/src/daemon/lldpd.c @@ -1844,7 +1844,7 @@ lldpd_main(int argc, char *argv[], char *envp[]) #ifdef ENABLE_PRIVSEP priv_init(PRIVSEP_CHROOT, ctl, uid, gid); #else - priv_init(PRIVSEP_CHROOT, ctl, 0, 0); + priv_init(); #endif /* Initialization of global configuration */ diff --git a/src/daemon/lldpd.h b/src/daemon/lldpd.h index 32581e59..7b2ea916 100644 --- a/src/daemon/lldpd.h +++ b/src/daemon/lldpd.h @@ -194,7 +194,11 @@ client_handle_client(struct lldpd *cfg, int*); /* priv.c */ +#ifdef ENABLE_PRIVSEP void priv_init(const char*, int, uid_t, gid_t); +#else +void priv_init(void); +#endif void priv_wait(void); void priv_ctl_cleanup(const char *ctlname); char *priv_gethostname(void); diff --git a/src/daemon/priv.c b/src/daemon/priv.c index ba5ae58c..78ac3351 100644 --- a/src/daemon/priv.c +++ b/src/daemon/priv.c @@ -682,7 +682,11 @@ 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) +#else +priv_init(void) +#endif { int pair[2]; -- 2.39.5