clamd: use setrlimit() also when using GNU libc

setrlimit() is a POSIX API; while it can be used in more places, expand
its usage to any platform based on GNU libc.
This commit is contained in:
Pino Toscano 2025-08-18 22:02:47 +02:00 committed by Val S.
parent f95afb4a19
commit 39c80e3df7
No known key found for this signature in database
GPG key ID: 3A7D293D8274CA1B

View file

@ -51,7 +51,7 @@
#include <syslog.h>
#endif
#ifdef C_LINUX
#if defined(C_LINUX) || defined(__GLIBC__)
#include <sys/resource.h>
#endif
@ -150,7 +150,7 @@ int main(int argc, char **argv)
struct sigaction sa;
int dropPrivRet = 0;
#endif
#if defined(C_LINUX) || (defined(RLIMIT_DATA) && defined(C_BSD))
#if defined(C_LINUX) || defined(__GLIBC__) || (defined(RLIMIT_DATA) && defined(C_BSD))
struct rlimit rlim;
#endif
time_t currtime;
@ -201,7 +201,7 @@ int main(int argc, char **argv)
}
if (optget(opts, "debug")->enabled) {
#if defined(C_LINUX)
#if defined(C_LINUX) || defined(__GLIBC__)
/* njh@bandsman.co.uk: create a dump if needed */
rlim.rlim_cur = rlim.rlim_max = RLIM_INFINITY;
if (setrlimit(RLIMIT_CORE, &rlim) < 0)