From 99a780cbfde566a8336727b1468ed7928f0c4a46 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 28 Feb 1997 00:46:34 +0000 Subject: Slightly more sane rlimit usage. --- sbin/fsirand/fsirand.c | 17 +++++++++-------- 1 file 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 @@ -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 @@ -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) -- cgit v1.2.3