]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tree-wide: make personality codepaths unconditional
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 4 May 2021 11:27:20 +0000 (13:27 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 4 May 2021 13:27:44 +0000 (15:27 +0200)
Now that we have the infra to make personality handling unconitional
remove the ifndefs everywhere.

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c
src/lxc/conf.c
src/lxc/confile.c
src/lxc/syscall_wrappers.h

index e4cf17b5a639cebfa4e0b2509c8071dddb1a4eb0..08bcb449ee337589d5842c2c6eaa5ce76e0e17b1 100644 (file)
 #include "terminal.h"
 #include "utils.h"
 
-#if HAVE_SYS_PERSONALITY_H
-#include <sys/personality.h>
-#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);
index ecac10950971fba91044f493451eb1bf0ebe51e4..dda0e2bb62212ade5fd7206b1f4124c6a16622d1 100644 (file)
 #include <sys/capability.h>
 #endif
 
-#if HAVE_SYS_PERSONALITY_H
-#include <sys/personality.h>
-#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;
 }
index ba24ed77c0ab7e1d56b15498f87534131bf57884..02d63dfe46e2f0a70334b070359de7cf56e32b74 100644 (file)
 #include "storage/storage.h"
 #include "utils.h"
 
-#if HAVE_SYS_PERSONALITY_H
-#include <sys/personality.h>
-#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;
 }
index e340f7f07df5cd453f8ce0c1c0ba1f129c54aed8..4c6ef0731ef4fbb299f6f3b49d7c9425e807cbec 100644 (file)
 #include <linux/openat2.h>
 #endif
 
+#if HAVE_SYS_PERSONALITY_H
+#include <sys/personality.h>
+#endif
+
 typedef int32_t key_serial_t;
 
 #if !HAVE_KEYCTL