From 5c0532d1cc989d2f78d2cd4a18058daa58143705 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 27 Oct 2010 05:47:48 +0200 Subject: mounts: automatically create /dev/stderr and friends early on boot so that they are around when we run shell scripts before udevd --- src/label.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/label.c') diff --git a/src/label.c b/src/label.c index 01f36eb6cc..d037c4c932 100644 --- a/src/label.c +++ b/src/label.c @@ -173,6 +173,31 @@ int label_fifofile_set(const char *path) { return r; } +int label_symlinkfile_set(const char *path) { + int r = 0; + +#ifdef HAVE_SELINUX + security_context_t filecon = NULL; + + if (!use_selinux() || !label_hnd) + return 0; + + if ((r = selabel_lookup_raw(label_hnd, &filecon, path, S_IFLNK)) == 0) { + if ((r = setfscreatecon(filecon)) < 0) { + log_error("Failed to set SELinux file context on %s: %m", path); + r = -errno; + } + + freecon(filecon); + } + + if (r < 0 && security_getenforce() == 0) + r = 0; +#endif + + return r; +} + int label_socket_set(const char *label) { #ifdef HAVE_SELINUX -- cgit v1.2.3-54-g00ecf