{
char filename[NAME_SIZE];
char partitionname[NAME_SIZE];
+ struct stat stats;
int retval;
int i;
char *pos;
snprintf(filename, NAME_SIZE, "%s/%s", udev_root, udev->name);
filename[NAME_SIZE-1] = '\0';
+ dbg("checking major/minor of device node '%s'", filename);
+ if (stat(filename, &stats) != 0)
+ return -1;
+
+ if (udev->devt && stats.st_rdev != udev->devt) {
+ info("device node '%s' points to a different device, skip removal", filename);
+ return -1;
+ }
+
info("removing device node '%s'", filename);
retval = unlink_secure(filename);
if (retval)
const char *temp;
int retval;
- if (udev->type != 'b' && udev->type != 'c')
+ if (udev->type != BLOCK && udev->type != CLASS)
return 0;
retval = udev_db_get_device(udev);