]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Assume <sys/resource.h> exists
authorAlejandro Colomar <alx@kernel.org>
Fri, 2 Dec 2022 21:20:55 +0000 (22:20 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 15 Dec 2022 22:22:05 +0000 (16:22 -0600)
It is required by POSIX.1-2001.

Cc: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
libmisc/limits.c
libmisc/pwd_init.c
libmisc/ulimit.c

index 4a63abcdceaed8fa82f7af5146dee9ee1647a676..b6141bed9846caf66547f3ade481777f2d4a640d 100644 (file)
@@ -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)
 
index fea85fe5509f52567945b040908c59a1ba7e843c..5e34905b3812a828f23c6f07bf87fed2d98b9254 100644 (file)
 #include <pwd.h>
 #include "getdef.h"
 #include "shadowlog.h"
-#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
 #define LIMITS
-#endif
 #ifdef LIMITS
 #ifndef LIMITS_FILE
 #define LIMITS_FILE "/etc/limits"
index a37e94c8d03758de0eabf43e5eb829751378a857..3c3d96e703d7ee7180e991df8622980d1d86a38e 100644 (file)
@@ -15,9 +15,7 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <sys/stat.h>
-#ifdef HAVE_SYS_RESOURCE_H
 #include <sys/resource.h>
-#endif
 
 #include "prototypes.h"
 
  */
 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);
index 6597cdb07c399a875af4c872dc30ad0cd3ac03f4..0123e040f8328322af677b433eb5e6466502a6cb 100644 (file)
 
 #ident "$Id$"
 
-#if HAVE_SYS_RESOURCE_H
-# include <sys/time.h>         /* for struct timeval on sunos4 */
+#include <sys/time.h>          /* for struct timeval on sunos4 */
 /* XXX - is the above ok or should it be <time.h> on ultrix? */
-# include <sys/resource.h>
-#endif
+#include <sys/resource.h>
 #include "prototypes.h"
 
 int set_filesize_limit (int blocks)