X-Git-Url: https://git.sven.stormbind.net/?p=sven%2Fexfatprogs.git;a=blobdiff_plain;f=fsck%2Ffsck.c;fp=fsck%2Ffsck.c;h=6131d13dc43cdf4d26067feebf735c1dea355d36;hp=00d1ca7f2c3620770547fc014ffc14a2d99d70e3;hb=dcb4e80c267579d1a68e3f34f6b750e2940dbcc2;hpb=20b882b37d525f27c85037871c4f35f7ad2c55ba diff --git a/fsck/fsck.c b/fsck/fsck.c index 00d1ca7..6131d13 100644 --- a/fsck/fsck.c +++ b/fsck/fsck.c @@ -261,7 +261,7 @@ static void exfat_free_dir_list(struct exfat *exfat) /* * get references of ancestors that include @child until the count of - * ancesters is not larger than @count and the count of characters of + * ancestors is not larger than @count and the count of characters of * their names is not larger than @max_char_len. * return true if root is reached. */ @@ -1477,6 +1477,11 @@ static char *bytes_to_human_readable(size_t bytes) shift += 10; } + if (i >= sizeof(units)/sizeof(units[0])) { + i = i - 1; + shift = shift - 10; + } + quoti = (unsigned int)(bytes / (1ULL << shift)); remain = 0; if (shift > 0) { @@ -1596,8 +1601,10 @@ int main(int argc, char * const argv[]) goto err; ret = init_exfat(exfat, bs); - if (ret) + if (ret) { + exfat = NULL; goto err; + } if (exfat_mark_volume_dirty(exfat, true)) { ret = -EIO;