Fix fd leak in libdisk's Disk_Names()

This commit is contained in:
imp 2000-03-10 22:54:04 +00:00
parent d3a1fb7278
commit a4af1d9ca0

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;