- fprintf(stderr, "Unable to open %s\n", dstdev);
- goto leave_with_error;
- }
- ret = btrfs_scan_one_device(fddstdev, dstdev, &fs_devices_mnt,
- &total_devs, BTRFS_SUPER_INFO_OFFSET);
- if (ret >= 0 && !force_using_targetdev) {
- fprintf(stderr,
- "Error, target device %s contains filesystem, use '-f' to force overwriting.\n",
- dstdev);
- goto leave_with_error;
- }
- ret = fstat(fddstdev, &st);
- if (ret) {
- fprintf(stderr, "Error: Unable to stat '%s'\n", dstdev);
- goto leave_with_error;
- }
- if (!S_ISBLK(st.st_mode)) {
- fprintf(stderr, "Error: '%s' is not a block device\n", dstdev);