|
From: Robert W. <ro...@us...> - 2005-05-26 20:35:28
|
Thanks for the fix....I applied it to our CVS tree.
-Robbie
(Embedded image moved to file: pic28994.jpg)
"Jin, Gordon"
<gordon.jin@intel
.com> To
Sent by: <ltp...@li...>
ltp-list-admin@li cc
sts.sourceforge.n "Gavrilova, Tatiana G"
et <tat...@in...>,
"Fu, Michael"
<mic...@in...>
05/25/2005 10:14 Subject
PM [LTP] [PATCH] setrlimit02 fix --
not to use NR_OPEN
test3 in setrlimit02.c:
Test attempts to increase hard limit of RLIMIT_NOFILE resource.
The rlim_max used by setrlimit() is expected to be greater than
current hard limit to get EPERM.
In current code, the rlim_max used by setrlimit() is NR_OPEN + 1.
But NR_OPEN+1 can't be guaranteed to be always greater than current hard
limit, because current hard limit can be changed dynamically, e.g. in
/etc/security/limits.conf.
So the test fails in some conditions.
Attached patch fixes by not using NR_OPEN. Please apply.
Thanks,
Gordon
--- setrlimit02.c.ori 2005-05-25 10:26:31.000000000 +0800
+++ setrlimit02.c 2005-05-25 12:15:29.000000000 +0800
@@ -43,7 +43,6 @@
#include <sys/resource.h>
#include <unistd.h>
#include <errno.h>
-#include <linux/fs.h>
#include <pwd.h>
#include "test.h"
#include "usctest.h"
@@ -158,7 +157,8 @@
/* set an illegal value for a non-root user - test #3 - EPERM
*/
- rlim.rlim_max = NR_OPEN + 1;
+ getrlimit(RLIMIT_NOFILE, &rlim);
+ rlim.rlim_max ++;
}
/*
(See attached file: setrlimit02.diff) |