summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:00:35 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:00:35 +0000
commit3f7b961fefb1ddcfd625d0632f8fc9fe329976ac (patch)
treedd4ed4f55de937e63bdd649a4e29a2c5bf819703
parent054339564e62da54b9ea60e6ccac877a938538a6 (diff)
parent4f36a18db8d324e8495f2a237e4824c03182e4ab (diff)
downloadfsck_msdos-3f7b961fefb1ddcfd625d0632f8fc9fe329976ac.tar.gz
Change-Id: Ib3a64851a250456f0dd7e5b1882acb3d07cc82c9
-rw-r--r--Android.bp17
-rw-r--r--check.c4
-rw-r--r--dir.c17
3 files changed, 6 insertions, 32 deletions
diff --git a/Android.bp b/Android.bp
index 563b50a..3d57578 100644
--- a/Android.bp
+++ b/Android.bp
@@ -1,20 +1,3 @@
-package {
- default_applicable_licenses: ["external_fsck_msdos_license"],
-}
-
-// Added automatically by a large-scale-change
-// See: http://go/android-license-faq
-license {
- name: "external_fsck_msdos_license",
- visibility: [":__subpackages__"],
- license_kinds: [
- "SPDX-license-identifier-BSD",
- ],
- license_text: [
- "NOTICE",
- ],
-}
-
cc_binary {
name: "fsck_msdos",
srcs: [
diff --git a/check.c b/check.c
index c164316..9519315 100644
--- a/check.c
+++ b/check.c
@@ -186,10 +186,8 @@ checkfilesys(const char *fname)
free(fat);
close(dosfs);
- if (mod & (FSFATMOD|FSDIRMOD)){
+ if (mod & (FSFATMOD|FSDIRMOD))
pwarn("\n***** FILE SYSTEM WAS MODIFIED *****\n");
- return 4;
- }
return ret;
}
diff --git a/dir.c b/dir.c
index 010bd65..6bdc3b4 100644
--- a/dir.c
+++ b/dir.c
@@ -388,8 +388,7 @@ static int
checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir)
{
int ret = FSOK;
- size_t chainsize;
- u_int64_t physicalSize;
+ size_t physicalSize;
struct bootblock *boot;
boot = fat_get_boot(fat);
@@ -402,9 +401,9 @@ checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir)
} else {
if (!fat_is_valid_cl(fat, dir->head))
return FSERROR;
- ret = checkchain(fat, dir->head, &chainsize);
+ ret = checkchain(fat, dir->head, &physicalSize);
/*
- * Upon return, chainsize would hold the chain length
+ * Upon return, physicalSize would hold the chain length
* that checkchain() was able to validate, but if the user
* refused the proposed repair, it would be unsafe to
* proceed with directory entry fix, so bail out in that
@@ -413,16 +412,10 @@ checksize(struct fat_descriptor *fat, u_char *p, struct dosDirEntry *dir)
if (ret == FSERROR) {
return (FSERROR);
}
- /*
- * The maximum file size on FAT32 is 4GiB - 1, which
- * will occupy a cluster chain of exactly 4GiB in
- * size. On 32-bit platforms, since size_t is 32-bit,
- * it would wrap back to 0.
- */
- physicalSize = (u_int64_t)chainsize * boot->ClusterSize;
+ physicalSize *= boot->ClusterSize;
}
if (physicalSize < dir->size) {
- pwarn("size of %s is %u, should at most be %" PRIu64 "\n",
+ pwarn("size of %s is %u, should at most be %zu\n",
fullpath(dir), dir->size, physicalSize);
if (ask(1, "Truncate")) {
dir->size = physicalSize;