mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-22 10:07:12 +00:00
parser: fix compilation with missing RLIMIT macros
The define `RLIMIT_OFILE` is a historic macro originating from the BSDs, which is nowadays an alias for `RLIMIT_NOFILE`. On some implementations, it has thus been dropped in favor of the new define, but we still assume it will always be defined in our rlimit keywords table. Wrap it in an `ifdef` to fix compilation on systems where it does not exist. For the second macro `RLIMIT_RTTIME`, we do check for its existence in our keywords table, but then forgot to do so in the YACC rules. Wrap it into an `ifdef`, as well. Both patches serve the goal to fix compilation on musl libc. Signed-off-by: Patrick Steinhardt <ps@pks.im>
This commit is contained in:
parent
b973c9b473
commit
41c1e30e9b
@ -124,7 +124,9 @@ static struct keyword_table rlimit_table[] = {
|
||||
{"core", RLIMIT_CORE},
|
||||
{"rss", RLIMIT_RSS},
|
||||
{"nofile", RLIMIT_NOFILE},
|
||||
#ifdef RLIMIT_OFILE
|
||||
{"ofile", RLIMIT_OFILE},
|
||||
#endif
|
||||
{"as", RLIMIT_AS},
|
||||
{"nproc", RLIMIT_NPROC},
|
||||
{"memlock", RLIMIT_MEMLOCK},
|
||||
|
@ -902,6 +902,7 @@ rules: rules TOK_SET TOK_RLIMIT TOK_ID TOK_LE TOK_VALUE opt_id TOK_END_OF_RULE
|
||||
pwarn(_("RLIMIT 'cpu' no units specified using default units of seconds\n"));
|
||||
value = tmp;
|
||||
break;
|
||||
#ifdef RLIMIT_RTTIME
|
||||
case RLIMIT_RTTIME:
|
||||
/* RTTIME is measured in microseconds */
|
||||
if (!end || $6 == end || tmp < 0)
|
||||
@ -913,6 +914,7 @@ rules: rules TOK_SET TOK_RLIMIT TOK_ID TOK_LE TOK_VALUE opt_id TOK_END_OF_RULE
|
||||
pwarn(_("RLIMIT 'rttime' no units specified using default units of microseconds\n"));
|
||||
value = tmp;
|
||||
break;
|
||||
#endif
|
||||
case RLIMIT_NOFILE:
|
||||
case RLIMIT_NPROC:
|
||||
case RLIMIT_LOCKS:
|
||||
|
Loading…
x
Reference in New Issue
Block a user