]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
Remove uses of ulimit(3)
authorAlejandro Colomar <alx@kernel.org>
Fri, 2 Dec 2022 21:10:18 +0000 (22:10 +0100)
committerSerge Hallyn <serge@hallyn.com>
Thu, 15 Dec 2022 22:22:05 +0000 (16:22 -0600)
The function is obsolete.  It is recommended to use getrlimit(2) instead
(see the manual page for ulimit(3) or the POSIX manual for it).  Since
getrlimit(2) is required by POSIX.1-2001, we can rely on it.

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

index fd6c8207f10bb248894aa990332ac7f6fd6afc05..4a63abcdceaed8fa82f7af5146dee9ee1647a676 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 \
-       ulimit.h sys/capability.h sys/random.h sys/resource.h \
+       sys/capability.h sys/random.h sys/resource.h \
        gshadow.h lastlog.h rpc/key_prot.h netdb.h acl/libacl.h \
        attr/libattr.h attr/error_context.h)
 
index f835f6a84ce00c322f3ba8c6d835936f2db79465..6597cdb07c399a875af4c872dc30ad0cd3ac03f4 100644 (file)
 
 #ident "$Id$"
 
-#if HAVE_ULIMIT_H
-# include <ulimit.h>
-# ifndef UL_SETFSIZE
-#  ifdef UL_SFILLIM
-#   define UL_SETFSIZE UL_SFILLIM
-#  else
-#   define UL_SETFSIZE 2
-#  endif
-# endif
-#elif HAVE_SYS_RESOURCE_H
+#if HAVE_SYS_RESOURCE_H
 # 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>
 int set_filesize_limit (int blocks)
 {
        int ret = -1;
-#if HAVE_ULIMIT_H
-       if (ulimit (UL_SETFSIZE, blocks) != -1) {
-               ret = 0;
-       }
-#elif defined(RLIMIT_FSIZE)
+#if defined(RLIMIT_FSIZE)
        struct rlimit rlimit_fsize;
 
        rlimit_fsize.rlim_cur = 512L * blocks;