From: Christian Brauner Date: Tue, 4 May 2021 11:27:20 +0000 (+0200) Subject: tree-wide: make personality codepaths unconditional X-Git-Tag: lxc-5.0.0~178^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=386089920474a00161ab528e57d12ba4b4a280ba;p=thirdparty%2Flxc.git tree-wide: make personality codepaths unconditional Now that we have the infra to make personality handling unconitional remove the ifndefs everywhere. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index e4cf17b5a..08bcb449e 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -48,10 +48,6 @@ #include "terminal.h" #include "utils.h" -#if HAVE_SYS_PERSONALITY_H -#include -#endif - lxc_log_define(attach, lxc); /* Define default options if no options are supplied by the user. */ @@ -1147,7 +1143,6 @@ __noreturn static void do_attach(struct attach_payload *ap) } /* Now perform additional attachments. */ -#if HAVE_SYS_PERSONALITY_H if (options->attach_flags & LXC_ATTACH_SET_PERSONALITY) { long new_personality; @@ -1164,7 +1159,6 @@ __noreturn static void do_attach(struct attach_payload *ap) TRACE("Set new personality"); } } -#endif if (options->attach_flags & LXC_ATTACH_DROP_CAPABILITIES) { ret = drop_capabilities(ctx); diff --git a/src/lxc/conf.c b/src/lxc/conf.c index ecac10950..dda0e2bb6 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -80,10 +80,6 @@ #include #endif -#if HAVE_SYS_PERSONALITY_H -#include -#endif - #ifndef HAVE_STRLCAT #include "include/strlcat.h" #endif @@ -1732,11 +1728,10 @@ static int lxc_setup_devpts_child(struct lxc_handler *handler) return 0; } -static int setup_personality(int persona) +static int setup_personality(signed long persona) { int ret; -#if HAVE_SYS_PERSONALITY_H if (persona == -1) return 0; @@ -1744,8 +1739,7 @@ static int setup_personality(int persona) if (ret < 0) return log_error_errno(-1, errno, "Failed to set personality to \"0x%x\"", persona); - INFO("Set personality to \"0x%x\"", persona); -#endif + INFO("Set personality to \"0lx%lx\"", persona); return 0; } diff --git a/src/lxc/confile.c b/src/lxc/confile.c index ba24ed77c..02d63dfe4 100644 --- a/src/lxc/confile.c +++ b/src/lxc/confile.c @@ -39,10 +39,6 @@ #include "storage/storage.h" #include "utils.h" -#if HAVE_SYS_PERSONALITY_H -#include -#endif - #ifndef HAVE_STRLCPY #include "include/strlcpy.h" #endif @@ -3215,7 +3211,6 @@ void lxc_config_define_free(struct lxc_list *defines) signed long lxc_config_parse_arch(const char *arch) { -#if HAVE_SYS_PERSONALITY_H static struct per_name { char *name; unsigned long per; @@ -3252,7 +3247,6 @@ signed long lxc_config_parse_arch(const char *arch) for (int i = 0; i < len; i++) if (strequal(pername[i].name, arch)) return pername[i].per; -#endif return LXC_ARCH_UNCHANGED; } @@ -3735,7 +3729,6 @@ static int get_config_personality(const char *key, char *retv, int inlen, else memset(retv, 0, inlen); -#if HAVE_SYS_PERSONALITY_H int len = 0; switch (c->personality) { @@ -3748,7 +3741,6 @@ static int get_config_personality(const char *key, char *retv, int inlen, default: break; } -#endif return fulllen; } diff --git a/src/lxc/syscall_wrappers.h b/src/lxc/syscall_wrappers.h index e340f7f07..4c6ef0731 100644 --- a/src/lxc/syscall_wrappers.h +++ b/src/lxc/syscall_wrappers.h @@ -31,6 +31,10 @@ #include #endif +#if HAVE_SYS_PERSONALITY_H +#include +#endif + typedef int32_t key_serial_t; #if !HAVE_KEYCTL