- } else {
- fdsrcdev = open(srcdev, O_RDWR);
- if (fdsrcdev < 0) {
- fprintf(stderr, "Error: Unable to open device '%s'\n",
- srcdev);
- fprintf(stderr, "\tTry using the devid instead of the path\n");
- goto leave_with_error;
- }
- ret = fstat(fdsrcdev, &st);
- if (ret) {
- fprintf(stderr, "Error: Unable to stat '%s'\n", srcdev);
- goto leave_with_error;
- }
- if (!S_ISBLK(st.st_mode)) {
- fprintf(stderr, "Error: '%s' is not a block device\n",
- srcdev);
- goto leave_with_error;
- }