attach: introduce explicit personality macro

Introduce LXC_ATTACH_DETECT_PERSONALITY to make it explicit what is happening instead of using -1. Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 84fc7c27
......@@ -1147,7 +1147,7 @@ __noreturn static void do_attach(struct attach_payload *ap)
if (options->attach_flags & LXC_ATTACH_SET_PERSONALITY) {
long new_personality;
if (options->personality < 0)
if (options->personality == LXC_ATTACH_DETECT_PERSONALITY)
new_personality = ctx->personality;
else
new_personality = options->personality;
......
......@@ -82,6 +82,8 @@ typedef struct lxc_groups_t {
gid_t *list;
} lxc_groups_t;
#define LXC_ATTACH_DETECT_PERSONALITY ~0L
/*!
* LXC attach options for \ref lxc_container \c attach().
*/
......@@ -92,7 +94,7 @@ typedef struct lxc_attach_options_t {
/*! The namespaces to attach to (CLONE_NEW... flags) */
int namespaces;
/*! Initial personality (\c -1 to autodetect).
/*! Initial personality (\c LXC_ATTACH_DETECT_PERSONALITY to autodetect).
* \warning This may be ignored if lxc is compiled without personality
* support)
*/
......@@ -160,7 +162,7 @@ typedef struct lxc_attach_options_t {
{ \
.attach_flags = LXC_ATTACH_DEFAULT, \
.namespaces = -1, \
.personality = -1, \
.personality = LXC_ATTACH_DETECT_PERSONALITY, \
.initial_cwd = NULL, \
.uid = (uid_t)-1, \
.gid = (gid_t)-1, \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment