Skip to contentSkip to conversation

devmapper - don't modify api on selinux support

PATCH New Bastian Blank 1 participant 1 message Mar 10, 2008

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 devmapper - don't modify api on selinux support

Always include dm_set_selinux_context in libdevmapper.

lib/libdm-common.c +2 -4
@@ -233,9 +233,9 @@
 	return 1;
 }
 
-#ifdef HAVE_SELINUX
 int dm_set_selinux_context(const char *path, mode_t mode)
 {
+#ifdef HAVE_SELINUX
 	security_context_t scontext;
 
 	if (is_selinux_enabled() <= 0)
@@ -256,9 +256,9 @@
 	}
 
 	freecon(scontext);
+#endif
 	return 1;
 }
-#endif
 
 static int _add_dev_node(const char *dev_name, uint32_t major, uint32_t minor,
 			 uid_t uid, gid_t gid, mode_t mode)
@@ -302,10 +302,8 @@
 
 	log_debug("Created %s", path);
 
-#ifdef HAVE_SELINUX
 	if (!dm_set_selinux_context(path, S_IFBLK))
 		return 0;
-#endif
 
 	return 1;
 }
Signature · 3 lines
We fight only when there is no other choice.  We prefer the ways of
peaceful contact.
		-- Kirk, "Spectre of the Gun", stardate 4385.3