Fix fd leak in libdisk's Disk_Names()

This commit is contained in:
Warner Losh 2000-03-10 22:54:04 +00:00
parent 924f6734a5
commit ce5e608527

View File

@ -400,9 +400,13 @@ Disk_Names()
if ((fd = open(disk, O_RDWR)) == -1)
continue;
if (ioctl(fd, DIOCGSLICEINFO, &ds) == -1) {
#ifdef DEBUG
warn("DIOCGSLICEINFO %s", disk);
#endif
close(fd);
continue;
}
close(fd);
disks[k++] = strdup(diskname);
if(k == MAX_NO_DISKS)
return disks;