X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=udev_utils_file.c;h=9ab34705e2dd70c1d0becdc64c8db13439458273;hp=0ceefe17200c68bab8e08a20b0d3be2dc60834ee;hb=6056d9b3400fe0349d86636cbbf93f069bb5639a;hpb=e6d70ed63a03f39de148e6b0afb47cbbc5ec78eb diff --git a/udev_utils_file.c b/udev_utils_file.c index 0ceefe172..9ab34705e 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;