summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2003-07-29 20:26:24 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2003-07-29 20:26:24 +0000
commitb86fd036e8341bc573bb9d853ff0a0699a0f4dbf (patch)
treed908a6c3c7851153d2e689b9556c0c238b2fab21 /sbin
parent1cf66542404ed6558826b76b2f4483c16ec0f574 (diff)
If euid == 0 make datasize unlimited instead of cranking to the max
value returned by getrlimit(). Avoid resource limit issues when fscking very large filesystems.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/fsck/fsck.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
index 5fffc6b2c0c..8e31797f2be 100644
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.c,v 1.14 2003/06/26 08:01:54 tedu Exp $ */
+/* $OpenBSD: fsck.c,v 1.15 2003/07/29 20:26:23 millert Exp $ */
/* $NetBSD: fsck.c,v 1.7 1996/10/03 20:06:30 christos Exp $ */
/*
@@ -35,7 +35,7 @@
*
*/
-static const char rcsid[] = "$OpenBSD: fsck.c,v 1.14 2003/06/26 08:01:54 tedu Exp $";
+static const char rcsid[] = "$OpenBSD: fsck.c,v 1.15 2003/07/29 20:26:23 millert Exp $";
#include <sys/param.h>
#include <sys/mount.h>
@@ -95,7 +95,10 @@ main(int argc, char *argv[])
/* Increase our data size to the max */
if (getrlimit(RLIMIT_DATA, &rl) == 0) {
- rl.rlim_cur = rl.rlim_max;
+ if (geteuid() == 0)
+ rl.rlim_cur = rl.rlim_max = RLIM_INFINITY;
+ else
+ rl.rlim_cur = rl.rlim_max;
if (setrlimit(RLIMIT_DATA, &rl) < 0)
warn("Can't get resource limit to max data size");
} else