mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-10 08:17:46 +00:00
seccomp: get_v2_default_action()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
7ad3767052
commit
30448a13ab
@ -71,20 +71,26 @@ static uint32_t get_v2_default_action(char *line)
|
|||||||
|
|
||||||
while (*line == ' ')
|
while (*line == ' ')
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
/* After 'whitelist' or 'blacklist' comes default behavior. */
|
/* After 'whitelist' or 'blacklist' comes default behavior. */
|
||||||
if (strncmp(line, "kill", 4) == 0)
|
if (strncmp(line, "kill", 4) == 0) {
|
||||||
ret_action = SCMP_ACT_KILL;
|
ret_action = SCMP_ACT_KILL;
|
||||||
else if (strncmp(line, "errno", 5) == 0) {
|
} else if (strncmp(line, "errno", 5) == 0) {
|
||||||
int e;
|
int e, ret;
|
||||||
if (sscanf(line + 5, "%d", &e) != 1) {
|
|
||||||
ERROR("Bad errno value in %s", line);
|
ret = sscanf(line + 5, "%d", &e);
|
||||||
|
if (ret != 1) {
|
||||||
|
ERROR("Failed to parse errno value from %s", line);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret_action = SCMP_ACT_ERRNO(e);
|
ret_action = SCMP_ACT_ERRNO(e);
|
||||||
} else if (strncmp(line, "allow", 5) == 0)
|
} else if (strncmp(line, "allow", 5) == 0) {
|
||||||
ret_action = SCMP_ACT_ALLOW;
|
ret_action = SCMP_ACT_ALLOW;
|
||||||
else if (strncmp(line, "trap", 4) == 0)
|
} else if (strncmp(line, "trap", 4) == 0) {
|
||||||
ret_action = SCMP_ACT_TRAP;
|
ret_action = SCMP_ACT_TRAP;
|
||||||
|
}
|
||||||
|
|
||||||
return ret_action;
|
return ret_action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user