summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-02-28 00:46:34 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-02-28 00:46:34 +0000
commit99a780cbfde566a8336727b1468ed7928f0c4a46 (patch)
treed11e576540f2c02e9f350fe008d87e1886b71de8
parentefd9d144190ada0b2fbd04953d35db90927b0fc5 (diff)
Slightly more sane rlimit usage.
-rw-r--r--sbin/fsirand/fsirand.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sbin/fsirand/fsirand.c b/sbin/fsirand/fsirand.c
index 0049a1de411..0e4d9311842 100644
--- a/sbin/fsirand/fsirand.c
+++ b/sbin/fsirand/fsirand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsirand.c,v 1.8 1997/02/22 06:46:23 millert Exp $ */
+/* $OpenBSD: fsirand.c,v 1.9 1997/02/28 00:46:33 millert Exp $ */
/*
* Copyright (c) 1997 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -31,7 +31,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: fsirand.c,v 1.8 1997/02/22 06:46:23 millert Exp $";
+static char rcsid[] = "$OpenBSD: fsirand.c,v 1.9 1997/02/28 00:46:33 millert Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -86,12 +86,13 @@ main(argc, argv)
if (argc - optind < 1)
usage(1);
- /* Increase our max data size */
- if (getrlimit(RLIMIT_DATA, &rl) < 0)
- warn("getrlimit");
- rl.rlim_cur = rl.rlim_max;
- if (setrlimit(RLIMIT_DATA, &rl) < 0)
- warn("setrlimit");
+ /* Increase our data size to the max */
+ if (getrlimit(RLIMIT_DATA, &rl) == 0) {
+ rl.rlim_cur = rl.rlim_max;
+ if (setrlimit(RLIMIT_DATA, &rl) < 0)
+ warn("Can't get resource limit to max data size");
+ } else
+ warn("Can't get resource limit for data size");
for (n = optind; n < argc; n++) {
if (argc - optind != 1)