selinux: fix handling of relative paths when setting up create label
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user