X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev-remove.c;h=c20c651dc53687056d701c0a8714a7f5d39f3b9b;hb=896e5aa9aa6ea467a34b53d5053621b9cfc58548;hp=c21938fae77497843abe789c3743b87a5103c89c;hpb=d2cf99df7df132d8d90c4f7b438374618793c15a;p=elogind.git diff --git a/udev-remove.c b/udev-remove.c index c21938fae..c20c651dc 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -66,9 +66,11 @@ static int delete_path(char *path) static int delete_node(struct udevice *dev) { char filename[255]; + char partitionname[255]; char *symlinks; char *linkname; int retval; + int i; strncpy(filename, udev_root, sizeof(filename)); strncat(filename, dev->name, sizeof(filename)); @@ -81,11 +83,20 @@ static int delete_node(struct udevice *dev) 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++) { + sprintf(partitionname, "%s%i", filename, i); + unlink(partitionname); + } + } + /* remove subdirectories */ if (strchr(dev->name, '/')) delete_path(filename); - if (*dev->symlink) { + if (dev->symlink[0] != '\0') { symlinks = dev->symlink; while (1) { linkname = strsep(&symlinks, " ");