*/
if (list_empty(&udev->symlink_list) && list_empty(&udev->env_list) &&
!udev->partitions && !udev->ignore_remove) {
+ int ret;
dbg("nothing interesting to store, create symlink");
- if (symlink(udev->name, filename) != 0) {
+ selinux_setfscreatecon(filename, NULL, S_IFLNK);
+ ret = symlink(udev->name, filename);
+ selinux_resetfscreatecon();
+ if (ret != 0) {
err("unable to create db link '%s': %s", filename, strerror(errno));
return -1;
}
strlcat(filename, "/"RULES_DYN_DIR, sizeof(filename));
if (stat(filename, &statbuf) != 0) {
create_path(filename);
+ selinux_setfscreatecon(filename, NULL, S_IFDIR|0755);
mkdir(filename, 0755);
+ selinux_resetfscreatecon();
}
add_matching_files(&dyn_list, filename, RULESFILE_SUFFIX);
char p[PATH_SIZE];
char *pos;
struct stat stats;
+ int ret;
strlcpy(p, path, sizeof(p));
pos = strrchr(p, '/');
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;
delete_path(filename_failed);
create_path(filename);
+ selinux_setfscreatecon(filename, NULL, S_IFLNK);
symlink(msg->devpath, filename);
+ selinux_resetfscreatecon();
break;
case EVENT_FINISHED:
if (msg->devpath_old != NULL) {