Whamcloud - gitweb
unix_io.c (unix_open): Make sure the ulimit workaround works
authorTheodore Ts'o <tytso@mit.edu>
Mon, 3 Dec 2001 04:47:32 +0000 (05:47 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 3 Dec 2001 04:47:32 +0000 (05:47 +0100)
regardless of the version of glibc which is used to
compild e2fsprogs.

lib/ext2fs/ChangeLog
lib/ext2fs/unix_io.c

index 419feff..bd1bb09 100644 (file)
@@ -1,3 +1,9 @@
+2001-12-03  Theodore Tso  <tytso@valinux.com>
+
+       * unix_io.c (unix_open): Make sure the ulimit workaround works
+               regardless of the version of glibc which is used to
+               compild e2fsprogs.
+
 2001-11-26  Theodore Tso  <tytso@valinux.com>
 
        * unix_io.c (unix_open): Work around a bug in 2.4.10+ kernels by
index 1e01d28..7fa4b1a 100644 (file)
@@ -346,11 +346,11 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
            (S_ISBLK(st.st_mode))) {
                struct rlimit   rlim;
                
-               rlim.rlim_cur = RLIM_INFINITY;
-               rlim.rlim_max = RLIM_INFINITY;
+               rlim.rlim_cur = rlim.rlim_max = ((unsigned long)(~0UL));
                setrlimit(RLIMIT_FSIZE, &rlim);
                getrlimit(RLIMIT_FSIZE, &rlim);
-               if (rlim.rlim_cur != rlim.rlim_max) {
+               if (((unsigned long) rlim.rlim_cur) <
+                   ((unsigned long) rlim.rlim_max)) {
                        rlim.rlim_cur = rlim.rlim_max;
                        setrlimit(RLIMIT_FSIZE, &rlim);
                }