chiark / gitweb /
journal: remove build warning when SELinux is disabled
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Apr 2013 20:04:27 +0000 (13:04 -0700)
committerKay Sievers <kay@vrfy.org>
Thu, 25 Apr 2013 00:13:56 +0000 (02:13 +0200)
A small patch to remove a build warnining when SELinux is disabled.

src/journal/journald-server.c

index 4134e9fc67440a1b16eb9a9909090c486d0b616f..8eab5ad677a0a0d640cfd75fec086766b7a50ffb 100644 (file)
@@ -508,7 +508,7 @@ static void dispatch_message_real(
                 source_time[sizeof("_SOURCE_REALTIME_TIMESTAMP=") + DECIMAL_STR_MAX(usec_t)],
                 boot_id[sizeof("_BOOT_ID=") + 32] = "_BOOT_ID=",
                 machine_id[sizeof("_MACHINE_ID=") + 32] = "_MACHINE_ID=";
-        char *comm, *exe, *cmdline, *cgroup, *session, *unit, *selinux_context, *hostname;
+        char *comm, *exe, *cmdline, *cgroup, *session, *unit, *hostname;
         sd_id128_t id;
         int r;
         char *t, *c;
@@ -615,7 +615,7 @@ static void dispatch_message_real(
 
 #ifdef HAVE_SELINUX
                 if (label) {
-                        selinux_context = alloca(sizeof("_SELINUX_CONTEXT=") + label_len);
+                        char *selinux_context = alloca(sizeof("_SELINUX_CONTEXT=") + label_len);
 
                         *((char*) mempcpy(stpcpy(selinux_context, "_SELINUX_CONTEXT="), label, label_len)) = 0;
                         IOVEC_SET_STRING(iovec[n++], selinux_context);
@@ -623,7 +623,8 @@ static void dispatch_message_real(
                         security_context_t con;
 
                         if (getpidcon(ucred->pid, &con) >= 0) {
-                                selinux_context = strappenda("_SELINUX_CONTEXT=", con);
+                                char *selinux_context = strappenda("_SELINUX_CONTEXT=", con);
+
                                 freecon(con);
                                 IOVEC_SET_STRING(iovec[n++], selinux_context);
                         }