]> git.sven.stormbind.net Git - sven/exfatprogs.git/blobdiff - fsck/fsck.c
New upstream version 1.1.3
[sven/exfatprogs.git] / fsck / fsck.c
index 00d1ca7f2c3620770547fc014ffc14a2d99d70e3..6131d13dc43cdf4d26067feebf735c1dea355d36 100644 (file)
@@ -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;