Catch errors in personality handling better.
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
uid_t target_host_gid;
char *lsm_label;
struct lxc_container *container;
- signed long personality;
+ personality_t personality;
unsigned long long capability_mask;
int ns_inherited;
int ns_fd[LXC_NS_MAX];
}
static int get_personality(const char *name, const char *lxcpath,
- signed long *personality)
+ personality_t *personality)
{
__do_free char *p = NULL;
int ret;
new_personality = options->personality;
if (new_personality != LXC_ARCH_UNCHANGED) {
- ret = personality(new_personality);
+ ret = lxc_personality(new_personality);
if (ret < 0)
goto on_error;
return 0;
}
-static int setup_personality(signed long persona)
+static int setup_personality(personality_t persona)
{
int ret;
if (persona == LXC_ARCH_UNCHANGED)
return log_debug(0, "Retaining original personality");
- ret = personality(persona);
+ ret = lxc_personality(persona);
if (ret < 0)
return syserror("Failed to set personality to \"0lx%lx\"", persona);
#include "start.h"
#include "storage/storage.h"
#include "string_utils.h"
+#include "syscall_wrappers.h"
#include "terminal.h"
#if HAVE_SYS_RESOURCE_H
typedef void * scmp_filter_ctx;
#endif
+typedef signed long personality_t;
+
/* worth moving to configure.ac? */
#define subuidfile "/etc/subuid"
#define subgidfile "/etc/subgid"
const char *name;
bool is_execute;
int reboot;
- signed long personality;
+ personality_t personality;
struct utsname *utsname;
struct {
lxc_list_init(&bpf_devices->device_item);
}
+static inline int lxc_personality(personality_t persona)
+{
+ if (persona < 0)
+ return ret_errno(EINVAL);
+
+ return personality(persona);
+}
+
#endif /* __LXC_CONF_H */
struct lxc_conf *lxc_conf, void *data)
{
int ret;
- signed long personality;
+ personality_t personality;
ret = lxc_config_parse_arch(value, &personality);
if (ret < 0)