From 9d695340b47d9820743ca1fa4df15e9ea11b539f Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Fri, 2 Dec 2022 22:20:55 +0100 Subject: [PATCH] Assume exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It is required by POSIX.1-2001. Cc: Christian Göttsche Signed-off-by: Alejandro Colomar --- configure.ac | 2 +- libmisc/limits.c | 2 -- libmisc/pwd_init.c | 39 ++++++++++++++++----------------------- libmisc/ulimit.c | 6 ++---- 4 files changed, 19 insertions(+), 30 deletions(-) diff --git a/configure.ac b/configure.ac index 4a63abcd..b6141bed 100644 --- a/configure.ac +++ b/configure.ac @@ -38,7 +38,7 @@ dnl Checks for libraries. dnl Checks for header files. AC_CHECK_HEADERS(crypt.h utmp.h \ termio.h sgtty.h sys/ioctl.h paths.h \ - sys/capability.h sys/random.h sys/resource.h \ + sys/capability.h sys/random.h \ gshadow.h lastlog.h rpc/key_prot.h netdb.h acl/libacl.h \ attr/libattr.h attr/error_context.h) diff --git a/libmisc/limits.c b/libmisc/limits.c index fea85fe5..5e34905b 100644 --- a/libmisc/limits.c +++ b/libmisc/limits.c @@ -28,10 +28,8 @@ #include #include "getdef.h" #include "shadowlog.h" -#ifdef HAVE_SYS_RESOURCE_H #include #define LIMITS -#endif #ifdef LIMITS #ifndef LIMITS_FILE #define LIMITS_FILE "/etc/limits" diff --git a/libmisc/pwd_init.c b/libmisc/pwd_init.c index a37e94c8..3c3d96e7 100644 --- a/libmisc/pwd_init.c +++ b/libmisc/pwd_init.c @@ -15,9 +15,7 @@ #include #include #include -#ifdef HAVE_SYS_RESOURCE_H #include -#endif #include "prototypes.h" @@ -28,39 +26,34 @@ */ void pwd_init (void) { -#ifdef HAVE_SYS_RESOURCE_H struct rlimit rlim; -# ifdef RLIMIT_CORE +#ifdef RLIMIT_CORE rlim.rlim_cur = rlim.rlim_max = 0; setrlimit (RLIMIT_CORE, &rlim); -# endif +#endif rlim.rlim_cur = rlim.rlim_max = RLIM_INFINITY; -# ifdef RLIMIT_AS +#ifdef RLIMIT_AS setrlimit (RLIMIT_AS, &rlim); -# endif -# ifdef RLIMIT_CPU +#endif +#ifdef RLIMIT_CPU setrlimit (RLIMIT_CPU, &rlim); -# endif -# ifdef RLIMIT_DATA +#endif +#ifdef RLIMIT_DATA setrlimit (RLIMIT_DATA, &rlim); -# endif -# ifdef RLIMIT_FSIZE +#endif +#ifdef RLIMIT_FSIZE setrlimit (RLIMIT_FSIZE, &rlim); -# endif -# ifdef RLIMIT_NOFILE +#endif +#ifdef RLIMIT_NOFILE setrlimit (RLIMIT_NOFILE, &rlim); -# endif -# ifdef RLIMIT_RSS +#endif +#ifdef RLIMIT_RSS setrlimit (RLIMIT_RSS, &rlim); -# endif -# ifdef RLIMIT_STACK +#endif +#ifdef RLIMIT_STACK setrlimit (RLIMIT_STACK, &rlim); -# endif -#else /* !HAVE_SYS_RESOURCE_H */ - set_filesize_limit (30000); - /* don't know how to set the other limits... */ -#endif /* !HAVE_SYS_RESOURCE_H */ +#endif signal (SIGALRM, SIG_IGN); signal (SIGHUP, SIG_IGN); diff --git a/libmisc/ulimit.c b/libmisc/ulimit.c index 6597cdb0..0123e040 100644 --- a/libmisc/ulimit.c +++ b/libmisc/ulimit.c @@ -11,11 +11,9 @@ #ident "$Id$" -#if HAVE_SYS_RESOURCE_H -# include /* for struct timeval on sunos4 */ +#include /* for struct timeval on sunos4 */ /* XXX - is the above ok or should it be on ultrix? */ -# include -#endif +#include #include "prototypes.h" int set_filesize_limit (int blocks)