chiark / gitweb /
[PATCH] no error on enoent
[elogind.git] / udev-add.c
index 0d3131300ff9d175373d79d897493b7c3d376381..3a72c544b8b9b20af53c61153c6b4e3aee579bda 100644 (file)
@@ -38,6 +38,7 @@
 #include "udev.h"
 #include "udev_version.h"
 #include "udev_dbus.h"
+#include "udev_selinux.h"
 #include "logging.h"
 #include "namedev.h"
 #include "udevdb.h"
@@ -210,13 +211,17 @@ static int create_node(struct udevice *dev, int fake)
                info("creating device partition nodes '%s[1-%i]'", filename, dev->partitions);
                if (!fake) {
                        for (i = 1; i <= dev->partitions; i++) {
-                               sprintf(partitionname, "%s%i", filename, i);
+                               strfieldcpy(partitionname, filename);
+                               strintcat(partitionname, i);
                                make_node(partitionname, dev->major,
                                          dev->minor + i, dev->mode, uid, gid);
                        }
                }
        }
 
+       if (!fake)
+               selinux_add_node(filename);
+
        /* create symlink if requested */
        if (dev->symlink[0] != '\0') {
                symlinks = dev->symlink;
@@ -247,8 +252,6 @@ static int create_node(struct udevice *dev, int fake)
                                i++;
                        }
 
-                       if (linktarget[0] == '\0')
-                               strfieldcpy(linktarget, "./");
                        strfieldcat(linktarget, &dev->name[tail]);
 
                        /* unlink existing files to ensure that our symlink is created */