diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-10-27 05:47:48 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-10-27 05:47:48 +0200 |
commit | 5c0532d1cc989d2f78d2cd4a18058daa58143705 (patch) | |
tree | 9bdd6af7a17d9ddb8931a551992d77a61c65c4ed /src/label.c | |
parent | c4dcdb9f4785937f2b73700e66b8cafa452f60a7 (diff) |
mounts: automatically create /dev/stderr and friends early on boot so that they are around when we run shell scripts before udevd
Diffstat (limited to 'src/label.c')
-rw-r--r-- | src/label.c | 25 |
1 files changed, 25 insertions, 0 deletions
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 |