selinux: fix handling of relative paths when setting up create label

This commit is contained in:
Lennart Poettering
2014-10-24 01:15:53 +02:00
parent 989fc2c61c
commit a07e9cfb79
+2 -1
View File
@@ -23,6 +23,7 @@
#include <unistd.h> #include <unistd.h>
#include <malloc.h> #include <malloc.h>
#include <sys/un.h> #include <sys/un.h>
#ifdef HAVE_SELINUX #ifdef HAVE_SELINUX
#include <selinux/selinux.h> #include <selinux/selinux.h>
#include <selinux/label.h> #include <selinux/label.h>
@@ -328,7 +329,7 @@ int mac_selinux_create_file_prepare(const char *path, mode_t mode) {
if (!newpath) if (!newpath)
return -ENOMEM; return -ENOMEM;
r = selabel_lookup_raw(label_hnd, &filecon, newpath, S_IFDIR); r = selabel_lookup_raw(label_hnd, &filecon, newpath, mode);
} }
if (r < 0 && errno != ENOENT) if (r < 0 && errno != ENOENT)