Assume RLIMIT_FSIZE is defined

It is required by POSIX.1-2001.

Cc: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar 2022-12-02 22:55:18 +01:00 committed by Serge Hallyn
parent 91adf3b8bb
commit 5ebf28c999
3 changed files with 0 additions and 6 deletions

View File

@ -254,13 +254,11 @@ static int do_user_limits (const char *buf, const char *name)
/* RLIMIT_DATA - max data size (KB) */ /* RLIMIT_DATA - max data size (KB) */
retval |= setrlimit_value (RLIMIT_DATA, pp, 1024); retval |= setrlimit_value (RLIMIT_DATA, pp, 1024);
break; break;
#ifdef RLIMIT_FSIZE
case 'f': case 'f':
case 'F': case 'F':
/* RLIMIT_FSIZE - Maximum filesize (KB) */ /* RLIMIT_FSIZE - Maximum filesize (KB) */
retval |= setrlimit_value (RLIMIT_FSIZE, pp, 1024); retval |= setrlimit_value (RLIMIT_FSIZE, pp, 1024);
break; break;
#endif
#ifdef RLIMIT_NICE #ifdef RLIMIT_NICE
case 'i': case 'i':
case 'I': case 'I':

View File

@ -36,9 +36,7 @@ void pwd_init (void)
setrlimit (RLIMIT_CPU, &rlim); setrlimit (RLIMIT_CPU, &rlim);
setrlimit (RLIMIT_DATA, &rlim); setrlimit (RLIMIT_DATA, &rlim);
#ifdef RLIMIT_FSIZE
setrlimit (RLIMIT_FSIZE, &rlim); setrlimit (RLIMIT_FSIZE, &rlim);
#endif
#ifdef RLIMIT_NOFILE #ifdef RLIMIT_NOFILE
setrlimit (RLIMIT_NOFILE, &rlim); setrlimit (RLIMIT_NOFILE, &rlim);
#endif #endif

View File

@ -19,13 +19,11 @@
int set_filesize_limit (int blocks) int set_filesize_limit (int blocks)
{ {
int ret = -1; int ret = -1;
#if defined(RLIMIT_FSIZE)
struct rlimit rlimit_fsize; struct rlimit rlimit_fsize;
rlimit_fsize.rlim_cur = 512L * blocks; rlimit_fsize.rlim_cur = 512L * blocks;
rlimit_fsize.rlim_max = rlimit_fsize.rlim_cur; rlimit_fsize.rlim_max = rlimit_fsize.rlim_cur;
ret = setrlimit (RLIMIT_FSIZE, &rlimit_fsize); ret = setrlimit (RLIMIT_FSIZE, &rlimit_fsize);
#endif
return ret; return ret;
} }