From d1bc28c5b2efe60a0ee04d9c171928d0f3475654 Mon Sep 17 00:00:00 2001
From: Adam Duskett <Aduskett@gmail.com>
Date: Thu, 14 Jul 2016 13:26:23 -0400
Subject: [PATCH] Check to see if DBUS is enabled.

Adds a condition to prevent linking against dbus when at build time
dbus has not been enabled.

Updated for 2.5.

Signed-off-by: Matthew Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Adam Duskett <AdamDuskett@outlook.com>
Signed-off-by: Adam Duskett <Aduskett@gmail.com>
---
 policycoreutils/restorecond/Makefile | 2 ++
 policycoreutils/restorecond/user.c   | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/restorecond/Makefile b/restorecond/Makefile
index 92a4a4d..95f38a6 100644
--- a/restorecond/Makefile
+++ b/restorecond/Makefile
@@ -11,8 +11,10 @@ autostart_DATA = sealertauto.desktop
 INITDIR ?= $(DESTDIR)/etc/rc.d/init.d
 SELINUXDIR = $(DESTDIR)/etc/selinux
 
+ifdef ENABLE_DBUS
 DBUSFLAGS = -DHAVE_DBUS -I$(DESTDIR)/usr/include/dbus-1.0 -I$(DESTDIR)/usr/lib64/dbus-1.0/include -I$(DESTDIR)/usr/lib/dbus-1.0/include
 DBUSLIB = -ldbus-glib-1 -ldbus-1
+endif
 
 CFLAGS ?= -g -Werror -Wall -W
 override CFLAGS += -I$(DESTDIR)/usr/include $(DBUSFLAGS) -I$(DESTDIR)/usr/include/glib-2.0 \
diff --git a/restorecond/user.c b/restorecond/user.c
index 714aae7..a04cddb 100644
--- a/restorecond/user.c
+++ b/restorecond/user.c
@@ -54,7 +54,6 @@ static const char *PATH="/org/selinux/Restorecond";
 static const char *INTERFACE="org.selinux.RestorecondIface";
 static const char *RULE="type='signal',interface='org.selinux.RestorecondIface'";
 
-static int local_lock_fd = -1;
 
 static DBusHandlerResult
 signal_filter (DBusConnection *connection  __attribute__ ((__unused__)), DBusMessage *message, void *user_data)
@@ -101,6 +100,7 @@ static int dbus_server(GMainLoop *loop) {
 #include <selinux/selinux.h>
 #include <sys/file.h>
 
+static int local_lock_fd = -1;
 /* size of the event structure, not counting name */
 #define EVENT_SIZE  (sizeof (struct inotify_event))
 /* reasonable guess as to size of 1024 events */
-- 
2.7.4

