Testcase:
$ mount -oloop /etc/group /mnt
ioctl: LOOP_CLR_FD: Device or resource busy
mount: you must specify the filesystem type
$ losetup /dev/loop0
/dev/loop0: [0803]:
1931929 (/etc/group)
Signed-off-by: Matthias Koenig <mkoenig@suse.de>
return NULL;
id = volume_id_open_fd(fd);
- if (!id)
+ if (!id) {
+ close(fd);
return NULL;
+ }
/* TODO: use blkdev_get_size() */
if (ioctl(fd, BLKGETSIZE64, &size) != 0)
}
volume_id_close(id);
+ close(fd);
return value;
}
}
if (ioctl (fd, LOOP_CLR_FD, 0) < 0) {
perror ("ioctl: LOOP_CLR_FD");
+ close(fd);
return 1;
}
close (fd);