summaryrefslogtreecommitdiff
path: root/udev_utils_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'udev_utils_file.c')
-rw-r--r--udev_utils_file.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/udev_utils_file.c b/udev_utils_file.c
index 0ceefe1720..9ab34705e2 100644
--- a/udev_utils_file.c
+++ b/udev_utils_file.c
@@ -35,6 +35,7 @@ int create_path(const char *path)
char p[PATH_SIZE];
char *pos;
struct stat stats;
+ int ret;
strlcpy(p, path, sizeof(p));
pos = strrchr(p, '/');
@@ -53,8 +54,12 @@ int create_path(const char *path)
return -1;
dbg("mkdir '%s'", p);
- if (mkdir(p, 0755) == 0)
+ selinux_setfscreatecon(p, NULL, S_IFDIR|0755);
+ ret = mkdir(p, 0755);
+ selinux_resetfscreatecon();
+ if (ret == 0)
return 0;
+
if (errno == EEXIST)
if (stat(p, &stats) == 0 && (stats.st_mode & S_IFMT) == S_IFDIR)
return 0;