]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: make if clause easier to read
authorSami Kerola <kerolasa@iki.fi>
Sun, 15 Jul 2012 06:58:51 +0000 (08:58 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 16 Jul 2012 16:18:21 +0000 (18:18 +0200)
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
fdisks/fdisk.c

index 4d5ab02cebdf07b88c2d30981ae34680a8c8e52f..3fede9591b423311a9ce63cb5af26d2b28a98eae 100644 (file)
@@ -2080,27 +2080,26 @@ int main(int argc, char **argv)
                exit(EXIT_SUCCESS);
        }
 
-       if (argc-optind == 1) {
-               cxt = fdisk_new_context_from_filename(argv[optind], 0);
-               if (!cxt)
-                       err(EXIT_FAILURE, _("unable to open %s"), argv[optind]);
-               if (sector_size) /* passed -b option, override autodiscovery */
-                       cxt->phy_sector_size = cxt->sector_size = sector_size;
-               /* passed CHS option(s), override autodiscovery */
-               if (user_cylinders)
-                       cxt->geom.cylinders = user_cylinders;
-               if (user_heads) {
-                       cxt->geom.heads = user_heads;
-                       fdisk_geom_set_cyls(cxt);
-               }
-               if (user_sectors) {
-                       cxt->geom.sectors = user_sectors;
-                       fdisk_geom_set_cyls(cxt);
-               }
-       }
-       else
+       if (argc-optind != 1)
                usage(stderr);
 
+       cxt = fdisk_new_context_from_filename(argv[optind], 0);
+       if (!cxt)
+               err(EXIT_FAILURE, _("unable to open %s"), argv[optind]);
+       if (sector_size)        /* passed -b option, override autodiscovery */
+               cxt->phy_sector_size = cxt->sector_size = sector_size;
+       /* passed CHS option(s), override autodiscovery */
+       if (user_cylinders)
+               cxt->geom.cylinders = user_cylinders;
+       if (user_heads) {
+               cxt->geom.heads = user_heads;
+               fdisk_geom_set_cyls(cxt);
+       }
+       if (user_sectors) {
+               cxt->geom.sectors = user_sectors;
+               fdisk_geom_set_cyls(cxt);
+       }
+
        print_welcome();
 
        if (!fdisk_dev_sectsz_is_default(cxt))