summaryrefslogtreecommitdiff
path: root/udev_utils_file.c
diff options
context:
space:
mode:
authorHarald Hoyer <harald@redhat.com>2008-04-17 16:03:03 +0200
committerKay Sievers <kay.sievers@vrfy.org>2008-04-17 19:07:24 +0200
commit6056d9b3400fe0349d86636cbbf93f069bb5639a (patch)
treedde618e113dedd6622a33bb3e52ebc1e25c3bb40 /udev_utils_file.c
parente6d70ed63a03f39de148e6b0afb47cbbc5ec78eb (diff)
selinux: more context settings
Signed-off-by: Harald Hoyer <harald@redhat.com>
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;