aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/mkfs_vfat.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index 705c75c20..72c2058b5 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -323,9 +323,20 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
323 * fs size <= 16G: 8k clusters 323 * fs size <= 16G: 8k clusters
324 * fs size > 16G: 16k clusters 324 * fs size > 16G: 16k clusters
325 */ 325 */
326 sect_per_clust = volume_size_bytes >= ((off_t)16)*1024*1024*1024 ? 32 : 326 sect_per_clust = 1;
327 volume_size_bytes >= ((off_t)8)*1024*1024*1024 ? 16 : 327 if (volume_size_bytes >= 260*1024*1024) {
328 volume_size_bytes >= 260*1024*1024 ? 8 : 1; 328 sect_per_clust = 8;
329 /* fight gcc: */
330 /* "error: integer overflow in expression" */
331 /* "error: right shift count >= width of type" */
332 if (sizeof(off_t) > 4) {
333 unsigned t = (volume_size_bytes >> 31 >> 1);
334 if (t >= 8/4)
335 sect_per_clust = 16;
336 if (t >= 16/4)
337 sect_per_clust = 32;
338 }
339 }
329 } else { 340 } else {
330 // floppy, loop, or regular file 341 // floppy, loop, or regular file
331 int not_floppy = ioctl(dev, FDGETPRM, &param); 342 int not_floppy = ioctl(dev, FDGETPRM, &param);