[systemd-devel] [PATCH] Fix compilation without ACL

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Jul 6 06:14:35 PDT 2011


Compilation fails if sys/acl.h is not available. The configure script
already tests for sys/acl.h presence, but the result was so far
unused.  To compile without acl, stub implementations of the acl
functions are used.

---
 Makefile.am      |    9 ++++++---
 src/logind-acl.h |   14 ++++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git Makefile.am Makefile.am
index 9a67505..85a1d04 100644
--- Makefile.am
+++ Makefile.am
@@ -879,7 +879,6 @@ systemd_logind_SOURCES = \
         src/logind-session-dbus.c \
         src/logind-user.c \
         src/logind-user-dbus.c \
-        src/logind-acl.c \
         src/dbus-common.c \
         src/dbus-loop.c \
         src/cgroup-util.c \
@@ -899,8 +898,12 @@ systemd_logind_LDADD = \
         $(ACL_LIBS)

 systemd_uaccess_SOURCES = \
-	src/uaccess.c \
-        src/logind-acl.c
+	src/uaccess.c
+
+if HAVE_ACL
+systemd_logind_SOURCES += src/logind-acl.c
+systemd_uaccess_SOURCES += src/logind-acl.c
+endif

 systemd_uaccess_CFLAGS = \
 	$(AM_CFLAGS) \
diff --git src/logind-acl.h src/logind-acl.h
index 9c88a80..8c13226 100644
--- src/logind-acl.h
+++ src/logind-acl.h
@@ -37,4 +37,18 @@ int devnode_acl_all(struct udev *udev,
                     bool del, uid_t old_uid,
                     bool add, uid_t new_uid);

+#ifndef HAVE_ACL
+inline
+int devnode_acl(const char *path,
+                bool flush,
+                bool del, uid_t old_uid,
+                bool add, uid_t new_uid) { return 0; }
+inline
+int devnode_acl_all(struct udev *udev,
+                    const char *seat,
+                    bool flush,
+                    bool del, uid_t old_uid,
+                    bool add, uid_t new_uid) { return 0; }
+#endif
+
 #endif
-- 
1.7.4.4



More information about the systemd-devel mailing list