Signed-off-by: Karel Zak <kzak@redhat.com>
}
if (ioctl(fd, LOOP_SET_FD, ffd) < 0) {
- close(fd);
- close(ffd);
+ int rc = 1;
+
if (errno == EBUSY) {
if (verbose)
- printf(_("ioctl LOOP_SET_FD failed: %s\n"), strerror(errno));
- return 2;
- } else {
+ printf(_("ioctl LOOP_SET_FD failed: %s\n"),
+ strerror(errno));
+ rc = 2;
+ } else
perror("ioctl: LOOP_SET_FD");
- return 1;
- }
+
+ close(fd);
+ close(ffd);
+ return rc;
}
close (ffd);
return 0;
}
-int
+int
del_loop (const char *device) {
int fd;