Lines 789-794
void get_kernel_uname_version(__u8 *version)
Link Here
|
789 |
#endif /* APPLE_DARWIN */ |
789 |
#endif /* APPLE_DARWIN */ |
790 |
|
790 |
|
791 |
#ifndef ANDROID_WINDOWS_HOST |
791 |
#ifndef ANDROID_WINDOWS_HOST |
|
|
792 |
static int open_check_fs(char *path, int flag) |
793 |
{ |
794 |
if (c.func != FSCK || c.fix_on || c.auto_fix) |
795 |
return -1; |
796 |
|
797 |
/* allow to open ro */ |
798 |
return open(path, O_RDONLY | flag); |
799 |
} |
800 |
|
792 |
int get_device_info(int i) |
801 |
int get_device_info(int i) |
793 |
{ |
802 |
{ |
794 |
int32_t fd = 0; |
803 |
int32_t fd = 0; |
Lines 810-817
int get_device_info(int i)
Link Here
|
810 |
if (c.sparse_mode) { |
819 |
if (c.sparse_mode) { |
811 |
fd = open(dev->path, O_RDWR | O_CREAT | O_BINARY, 0644); |
820 |
fd = open(dev->path, O_RDWR | O_CREAT | O_BINARY, 0644); |
812 |
if (fd < 0) { |
821 |
if (fd < 0) { |
813 |
MSG(0, "\tError: Failed to open a sparse file!\n"); |
822 |
fd = open_check_fs(dev->path, O_BINARY); |
814 |
return -1; |
823 |
if (fd < 0) { |
|
|
824 |
MSG(0, "\tError: Failed to open a sparse file!\n"); |
825 |
return -1; |
826 |
} |
815 |
} |
827 |
} |
816 |
} |
828 |
} |
817 |
|
829 |
|
Lines 825-834
int get_device_info(int i)
Link Here
|
825 |
return -1; |
837 |
return -1; |
826 |
} |
838 |
} |
827 |
|
839 |
|
828 |
if (S_ISBLK(stat_buf->st_mode) && !c.force) |
840 |
if (S_ISBLK(stat_buf->st_mode) && !c.force) { |
829 |
fd = open(dev->path, O_RDWR | O_EXCL); |
841 |
fd = open(dev->path, O_RDWR | O_EXCL); |
830 |
else |
842 |
if (fd < 0) |
|
|
843 |
fd = open_check_fs(dev->path, O_EXCL); |
844 |
} else { |
831 |
fd = open(dev->path, O_RDWR); |
845 |
fd = open(dev->path, O_RDWR); |
|
|
846 |
if (fd < 0) |
847 |
fd = open_check_fs(dev->path, 0); |
848 |
} |
832 |
} |
849 |
} |
833 |
if (fd < 0) { |
850 |
if (fd < 0) { |
834 |
MSG(0, "\tError: Failed to open the device!\n"); |
851 |
MSG(0, "\tError: Failed to open the device!\n"); |
835 |
- |
|
|