mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-30 22:05:27 +00:00
parser: fix rlimit ofile when built on musl libc
glibc defines bsd's rlimit ofile as nofile, however musl. Instead of just dropping ofile which would be bad for policy portability make sure it is defined to be nofile. This is a partial fie for https://gitlab.com/apparmor/apparmor/-/issues/513 Signed-off-by: John Johansen <john.johansen@canonical.com>
This commit is contained in:
@@ -134,6 +134,11 @@ static const unordered_map<string, int> keyword_table = {
|
||||
{"priority", TOK_PRIORITY},
|
||||
};
|
||||
|
||||
/* glibc maps bsd ofile to nofile but musl does not. */
|
||||
#ifndef RLIMIT_OFILE
|
||||
#define RLIMIT_OFILE RLIMIT_NOFILE
|
||||
#endif
|
||||
|
||||
static const unordered_map<string, int> rlimit_table = {
|
||||
{"cpu", RLIMIT_CPU},
|
||||
{"fsize", RLIMIT_FSIZE},
|
||||
@@ -142,9 +147,7 @@ static const unordered_map<string, int> 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},
|
||||
|
Reference in New Issue
Block a user