+ char filename[NAME_SIZE];
+ char linkname[NAME_SIZE];
+ char partitionname[NAME_SIZE];
+ int retval;
+ int i;
+ char *pos;
+ int len;
+
+ strfieldcpy(filename, udev_root);
+ strfieldcat(filename, dev->name);
+
+ info("removing device node '%s'", filename);
+ retval = secure_unlink(filename);
+ if (retval)
+ return retval;
+
+ /* remove partition nodes */
+ if (dev->partitions > 0) {
+ info("removing partitions '%s[1-%i]'", filename, dev->partitions);
+ for (i = 1; i <= dev->partitions; i++) {
+ strfieldcpy(partitionname, filename);
+ strintcat(partitionname, i);
+ secure_unlink(partitionname);
+ }
+ }
+
+ /* remove subdirectories */
+ if (strchr(dev->name, '/'))
+ delete_path(filename);
+
+ foreach_strpart(dev->symlink, " ", pos, len) {
+ strfieldcpymax(linkname, pos, len+1);
+ strfieldcpy(filename, udev_root);
+ strfieldcat(filename, linkname);