aboutsummaryrefslogtreecommitdiff
path: root/util-linux/fdisk.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux/fdisk.c')
-rw-r--r--util-linux/fdisk.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 6a194fd1a..c9f57c6d6 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -2821,7 +2821,7 @@ unknown_command(int c)
2821#endif 2821#endif
2822 2822
2823int fdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 2823int fdisk_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
2824int fdisk_main(int argc, char **argv) 2824int fdisk_main(int argc UNUSED_PARAM, char **argv)
2825{ 2825{
2826 unsigned opt; 2826 unsigned opt;
2827 /* 2827 /*
@@ -2839,7 +2839,6 @@ int fdisk_main(int argc, char **argv)
2839 opt_complementary = "b+:C+:H+:S+"; /* numeric params */ 2839 opt_complementary = "b+:C+:H+:S+"; /* numeric params */
2840 opt = getopt32(argv, "b:C:H:lS:u" IF_FEATURE_FDISK_BLKSIZE("s"), 2840 opt = getopt32(argv, "b:C:H:lS:u" IF_FEATURE_FDISK_BLKSIZE("s"),
2841 &sector_size, &user_cylinders, &user_heads, &user_sectors); 2841 &sector_size, &user_cylinders, &user_heads, &user_sectors);
2842 argc -= optind;
2843 argv += optind; 2842 argv += optind;
2844 if (opt & OPT_b) { // -b 2843 if (opt & OPT_b) { // -b
2845 /* Ugly: this sector size is really per device, 2844 /* Ugly: this sector size is really per device,
@@ -2883,14 +2882,14 @@ int fdisk_main(int argc, char **argv)
2883 int j; 2882 int j;
2884 2883
2885 nowarn = 1; 2884 nowarn = 1;
2886 if (argc <= 0) 2885 if (!argv[0])
2887 bb_show_usage(); 2886 bb_show_usage();
2888 for (j = 0; j < argc; j++) { 2887 for (j = 0; argv[j]; j++) {
2889 unsigned long long size; 2888 unsigned long long size;
2890 fd = xopen(argv[j], O_RDONLY); 2889 fd = xopen(argv[j], O_RDONLY);
2891 size = bb_BLKGETSIZE_sectors(fd) / 2; 2890 size = bb_BLKGETSIZE_sectors(fd) / 2;
2892 close(fd); 2891 close(fd);
2893 if (argc == 1) 2892 if (argv[1])
2894 printf("%llu\n", size); 2893 printf("%llu\n", size);
2895 else 2894 else
2896 printf("%s: %llu\n", argv[j], size); 2895 printf("%s: %llu\n", argv[j], size);
@@ -2900,7 +2899,7 @@ int fdisk_main(int argc, char **argv)
2900#endif 2899#endif
2901 2900
2902#if ENABLE_FEATURE_FDISK_WRITABLE 2901#if ENABLE_FEATURE_FDISK_WRITABLE
2903 if (argc != 1) 2902 if (!argv[0] || argv[1])
2904 bb_show_usage(); 2903 bb_show_usage();
2905 2904
2906 disk_device = argv[0]; 2905 disk_device = argv[0];