summaryrefslogtreecommitdiffstats
path: root/fdisks/fdisk.c
diff options
context:
space:
mode:
authorSami Kerola2012-07-15 08:58:51 +0200
committerKarel Zak2012-07-16 18:18:21 +0200
commit7d2ba34044662eb559f5eb158ec01e918fdec749 (patch)
treefc6fab72ea07286b26017aa6c7039e8037be4160 /fdisks/fdisk.c
parentlook: remove extra semicolon (diff)
downloadkernel-qcow2-util-linux-7d2ba34044662eb559f5eb158ec01e918fdec749.tar.gz
kernel-qcow2-util-linux-7d2ba34044662eb559f5eb158ec01e918fdec749.tar.xz
kernel-qcow2-util-linux-7d2ba34044662eb559f5eb158ec01e918fdec749.zip
fdisk: make if clause easier to read
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'fdisks/fdisk.c')
-rw-r--r--fdisks/fdisk.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c
index 4d5ab02ce..3fede9591 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))