util: introduce PERSONALITY_INVALID as macro for 0xffffffffLU
authorLennart Poettering <lennart@poettering.net>
Thu, 21 May 2015 17:48:49 +0000 (19:48 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 21 May 2015 17:48:49 +0000 (19:48 +0200)
src/core/execute.c
src/core/load-fragment.c
src/nspawn/nspawn.c
src/shared/util.c
src/shared/util.h

index 97498b2..e88a2dc 100644 (file)
@@ -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)));
index e1cd72f..9415e92 100644 (file)
@@ -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;
index d6b24c6..73f292e 100644 (file)
@@ -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) {
index 5f5cfcb..34024ba 100644 (file)
@@ -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) {
index 24a2672..7f72d3a 100644 (file)
@@ -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);