From: Kevin B. <kev...@gm...> - 2025-03-20 02:50:23
|
On 2025/03/20 10:00, Kevin Buckley wrote: > >> Regarding initgroups(): it seems like on BSD this is available in >> unistd.h, but on Linux it requires sys/types.h and grp.h. Could you test >> that this fixes the problem? >> >> Regarding asprintf(): This apparently requires defining the feature test >> macro _GNU_SOURCE on Linux. Could you confirm that defining this fixes >> the warning, and also doesn't break things? > > ISTRT that _GNU_SOURCE macro has been added in, for some other > compatability, in other source files. > > I'll take a look at the remaining two and get back to you. For the second one, I can confirm that this diff (which is similar to an old GGC5 patch against src/blocker/sshguard_whitelist.c) diff --git a/src/common/metrics.c b/src/common/metrics.c index c2c854d..524eda4 100644 --- a/src/common/metrics.c +++ b/src/common/metrics.c @@ -1,3 +1,4 @@ +#define _GNU_SOURCE #include <assert.h> #include <signal.h> #include <stdbool.h> does defeat the asprintf() warning. For the first one, just adding in "grp.h" seemed to defeat the initgroups() warning. FWIW, I tried adding "sys/types.h" on its own first and that didn't defeat the warning. Note that the following diff includes changes from your recently supplied patch as well as the "grp.h" inclusion. diff --git a/src/common/sandbox.c b/src/common/sandbox.c index 06853fe..a505831 100644 --- a/src/common/sandbox.c +++ b/src/common/sandbox.c @@ -1,6 +1,10 @@ #include "config.h" +#include <stdio.h> +#include <stdlib.h> #include <syslog.h> +#include <time.h> #include <unistd.h> +#include <grp.h> #include <pwd.h> #include "sandbox.h" HTH, Another Kevin |