If we retry opening the mountpoint and fail, we'll call
close on a filehandle w/ value -1. Rearrange so the
retry uses the same open and same error handling.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
path = argv[1];
+again:
fdmnt = open_file_or_dir(path);
if (fdmnt < 0) {
fprintf(stderr, "ERROR: scrub cancel failed\n");
- return 12;
+ return 1;
}
-again:
ret = ioctl(fdmnt, BTRFS_IOC_SCRUB_CANCEL, NULL);
err = errno;
ret = check_mounted_where(fdmnt, path, mp, sizeof(mp),
&fs_devices_mnt);
if (ret) {
- /* It is a device; open the mountpoint. */
+ /* It is a device; try again with the mountpoint. */
close(fdmnt);
- fdmnt = open_file_or_dir(mp);
- if (fdmnt >= 0) {
- path = mp;
- goto again;
- }
+ path = mp;
+ goto again;
}
}