diff options
author | Sami Kerola | 2014-09-03 21:46:29 +0200 |
---|---|---|
committer | Sami Kerola | 2014-09-19 20:31:01 +0200 |
commit | ee5de88c5169cbc658f1a4b45a32365bfa34626b (patch) | |
tree | 3832bab3278d86999f9db0d9db654199b9c8f677 /sys-utils/mountpoint.c | |
parent | mkfs.minix: fix couple compiler warnings (diff) | |
download | kernel-qcow2-util-linux-ee5de88c5169cbc658f1a4b45a32365bfa34626b.tar.gz kernel-qcow2-util-linux-ee5de88c5169cbc658f1a4b45a32365bfa34626b.tar.xz kernel-qcow2-util-linux-ee5de88c5169cbc658f1a4b45a32365bfa34626b.zip |
mountpoint: simplify if statement
Returning straight after print_devno() makes the code to be more obvious
and removes need for long else statement.
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'sys-utils/mountpoint.c')
-rw-r--r-- | sys-utils/mountpoint.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/sys-utils/mountpoint.c b/sys-utils/mountpoint.c index 4161d206f..0aaa290fe 100644 --- a/sys-utils/mountpoint.c +++ b/sys-utils/mountpoint.c @@ -132,7 +132,7 @@ static void __attribute__((__noreturn__)) usage(FILE *out) int main(int argc, char **argv) { - int c, rc = 0; + int c; struct mountpoint_control ctl = { 0 }; static const struct option longopts[] = { @@ -186,18 +186,15 @@ int main(int argc, char **argv) return EXIT_FAILURE; } if (ctl.dev_devno) - rc = print_devno(&ctl); - else { - if (dir_to_device(&ctl)) { - if (!ctl.quiet) - printf(_("%s is not a mountpoint\n"), ctl.path); - return EXIT_FAILURE; - } - if (ctl.fs_devno) - printf("%u:%u\n", major(ctl.dev), minor(ctl.dev)); - else if (!ctl.quiet) - printf(_("%s is a mountpoint\n"), ctl.path); + return print_devno(&ctl) ? EXIT_FAILURE : EXIT_SUCCESS; + if (dir_to_device(&ctl)) { + if (!ctl.quiet) + printf(_("%s is not a mountpoint\n"), ctl.path); + return EXIT_FAILURE; } - - return rc ? EXIT_FAILURE : EXIT_SUCCESS; + if (ctl.fs_devno) + printf("%u:%u\n", major(ctl.dev), minor(ctl.dev)); + else if (!ctl.quiet) + printf(_("%s is a mountpoint\n"), ctl.path); + return EXIT_SUCCESS; } |