diff options
author | Lennart Poettering <lennart@poettering.net> | 2015-05-21 19:48:49 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2015-05-21 19:48:49 +0200 |
commit | 050f727728f0631ce2b9c5f9635054480ccea3f6 (patch) | |
tree | 967efef2a54eb7b5e485f9401f38e7542f4edcfc | |
parent | 481a0aa2c9803a62cda413b8a1d05571957bb4b5 (diff) |
util: introduce PERSONALITY_INVALID as macro for 0xffffffffLU
-rw-r--r-- | src/core/execute.c | 6 | ||||
-rw-r--r-- | src/core/load-fragment.c | 2 | ||||
-rw-r--r-- | src/nspawn/nspawn.c | 6 | ||||
-rw-r--r-- | src/shared/util.c | 5 | ||||
-rw-r--r-- | src/shared/util.h | 7 |
5 files changed, 15 insertions, 11 deletions
diff --git a/src/core/execute.c b/src/core/execute.c index 97498b23d7..e88a2dc0ed 100644 --- a/src/core/execute.c +++ b/src/core/execute.c @@ -1491,7 +1491,7 @@ static int exec_child( return -errno; } - if (context->personality != 0xffffffffUL) + if (context->personality != PERSONALITY_INVALID) if (personality(context->personality) < 0) { *exit_status = EXIT_PERSONALITY; return -errno; @@ -1946,7 +1946,7 @@ void exec_context_init(ExecContext *c) { c->syslog_level_prefix = true; c->ignore_sigpipe = true; c->timer_slack_nsec = NSEC_INFINITY; - c->personality = 0xffffffffUL; + c->personality = PERSONALITY_INVALID; c->runtime_directory_mode = 0755; } @@ -2427,7 +2427,7 @@ void exec_context_dump(ExecContext *c, FILE* f, const char *prefix) { "%sSELinuxContext: %s%s\n", prefix, c->selinux_context_ignore ? "-" : "", c->selinux_context); - if (c->personality != 0xffffffffUL) + if (c->personality != PERSONALITY_INVALID) fprintf(f, "%sPersonality: %s\n", prefix, strna(personality_to_string(c->personality))); diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index e1cd72fe98..9415e92c90 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -3046,7 +3046,7 @@ int config_parse_personality( assert(personality); p = personality_from_string(rvalue); - if (p == 0xffffffffUL) { + if (p == PERSONALITY_INVALID) { log_syntax(unit, LOG_ERR, filename, line, EINVAL, "Failed to parse personality, ignoring: %s", rvalue); return 0; diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index d6b24c6f8f..73f292e284 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -195,7 +195,7 @@ static char **arg_network_macvlan = NULL; static char **arg_network_ipvlan = NULL; static bool arg_network_veth = false; static const char *arg_network_bridge = NULL; -static unsigned long arg_personality = 0xffffffffLU; +static unsigned long arg_personality = PERSONALITY_INVALID; static char *arg_image = NULL; static Volatile arg_volatile = VOLATILE_NO; static ExposePort *arg_expose_ports = NULL; @@ -823,7 +823,7 @@ static int parse_argv(int argc, char *argv[]) { case ARG_PERSONALITY: arg_personality = personality_from_string(optarg); - if (arg_personality == 0xffffffffLU) { + if (arg_personality == PERSONALITY_INVALID) { log_error("Unknown or unsupported personality '%s'.", optarg); return -EINVAL; } @@ -4128,7 +4128,7 @@ static int inner_child( setup_hostname(); - if (arg_personality != 0xffffffffLU) { + if (arg_personality != PERSONALITY_INVALID) { if (personality(arg_personality) < 0) return log_error_errno(errno, "personality() failed: %m"); } else if (secondary) { diff --git a/src/shared/util.c b/src/shared/util.c index 5f5cfcb011..34024bacc4 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -4837,10 +4837,7 @@ unsigned long personality_from_string(const char *p) { return PER_LINUX; #endif - /* personality(7) documents that 0xffffffffUL is used for - * querying the current personality, hence let's use that here - * as error indicator. */ - return 0xffffffffUL; + return PERSONALITY_INVALID; } const char* personality_to_string(unsigned long p) { diff --git a/src/shared/util.h b/src/shared/util.h index 24a2672846..7f72d3a867 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -816,6 +816,13 @@ int open_tmpfile(const char *path, int flags); int fd_warn_permissions(const char *path, int fd); +#ifndef PERSONALITY_INVALID +/* personality(7) documents that 0xffffffffUL is used for querying the + * current personality, hence let's use that here as error + * indicator. */ +#define PERSONALITY_INVALID 0xffffffffLU +#endif + unsigned long personality_from_string(const char *p); const char *personality_to_string(unsigned long); |