commit 1934c67fe5bc25a79393ad78e29bf9ef778bc701 Author: Doug Ledford Date: Tue Apr 6 23:02:47 2010 -0400 Only close lfd if we have an external metadata type since that's the only time we'll have it open. If we weren't able to open the device file, assume the device is gone already and skip the sysfs_unique_holder test as it is guaranteed to fail. Signed-off-by: Doug Ledford diff --git a/Manage.c b/Manage.c index b15586b..a690cfc 100644 --- a/Manage.c +++ b/Manage.c @@ -811,6 +811,7 @@ int Manage_subdevs(char *devname, int fd, * rely on the 'detached' checks */ if (strcmp(dv->devname, "detached") == 0 || + tfd < 0 || sysfs_unique_holder(dnum, stb.st_rdev)) /* pass */; else { @@ -878,8 +879,8 @@ int Manage_subdevs(char *devname, int fd, ping_manager(name); free(name); + close(lfd); } - close(lfd); if (verbose >= 0) fprintf(stderr, Name ": hot removed %s\n", dnprintable);