From: Sami Kerola Date: Sun, 15 Jul 2012 06:58:51 +0000 (+0200) Subject: fdisk: make if clause easier to read X-Git-Tag: v2.22-rc1~144^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7d2ba34044662eb559f5eb158ec01e918fdec749;p=thirdparty%2Futil-linux.git fdisk: make if clause easier to read Signed-off-by: Sami Kerola --- diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 4d5ab02ceb..3fede9591b 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -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))