summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2021-02-18 02:03:27 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2021-02-18 02:03:27 +0000
commitd6bef0d7b66611b671e2b8d9fdce85a553762ac3 (patch)
treea3968e4970cfd41c7c3b6852dee67840b000f2be
parente33ae6af244d27d4024ed785b6bb6e724a7456e9 (diff)
parent7c86b485f3a20cd65c7bca1941736d5418eb8969 (diff)
downloadnewfs_msdos-android12-d1-s1-release.tar.gz
Change-Id: I60783aa02797160aed379361e162da66d0007999
-rwxr-xr-xAndroid.bp17
-rw-r--r--mkfs_msdos.c8
2 files changed, 21 insertions, 4 deletions
diff --git a/Android.bp b/Android.bp
index a447263..f688898 100755
--- a/Android.bp
+++ b/Android.bp
@@ -1,3 +1,20 @@
+package {
+ default_applicable_licenses: ["external_newfs_msdos_license"],
+}
+
+// Added automatically by a large-scale-change
+// See: http://go/android-license-faq
+license {
+ name: "external_newfs_msdos_license",
+ visibility: [":__subpackages__"],
+ license_kinds: [
+ "SPDX-license-identifier-BSD",
+ ],
+ license_text: [
+ "LICENSE",
+ ],
+}
+
cc_binary {
name: "newfs_msdos",
c_std: "gnu11",
diff --git a/mkfs_msdos.c b/mkfs_msdos.c
index 08c435b..946096f 100644
--- a/mkfs_msdos.c
+++ b/mkfs_msdos.c
@@ -936,14 +936,14 @@ static int getdiskinfo(int fd, const char *fname, const char *dtype,
if (ckgeom(fname, bpb->bpbBytesPerSec, "bytes/sector") == -1) return -1;
- u_long device_size;
+ u_int64_t device_size;
if (ioctl(fd, BLKGETSIZE64, &device_size)) {
err(1, "ioctl(BLKGETSIZE64) failed");
}
- u_long sectors = device_size/bpb->bpbBytesPerSec;
- if (sectors > UINT32_MAX) {
- errx(1, "too many sectors: %lu (%lu byte device, %u bytes/sector)",
+ u_int64_t sectors = device_size/bpb->bpbBytesPerSec;
+ if (sectors > UINT_MAX) {
+ errx(1, "too many sectors: %"PRIu64" (%"PRIu64" byte device, %u bytes/sector)",
sectors, device_size, bpb->bpbBytesPerSec);
}
bpb->bpbHugeSectors = sectors;