summaryrefslogtreecommitdiffstats
path: root/misc-utils/lsblk.c
diff options
context:
space:
mode:
authorKarel Zak2019-04-16 15:14:13 +0200
committerKarel Zak2019-04-16 15:14:13 +0200
commit2c308875a7fa1aaa44892c368f6b37bcfcb8879a (patch)
tree157ea7afca59059676dbcc25133dd196d1e45fb8 /misc-utils/lsblk.c
parentinclude/c: add print_version() macro (diff)
downloadkernel-qcow2-util-linux-2c308875a7fa1aaa44892c368f6b37bcfcb8879a.tar.gz
kernel-qcow2-util-linux-2c308875a7fa1aaa44892c368f6b37bcfcb8879a.tar.xz
kernel-qcow2-util-linux-2c308875a7fa1aaa44892c368f6b37bcfcb8879a.zip
misc: consolidate version printing and close_stdout()
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils/lsblk.c')
-rw-r--r--misc-utils/lsblk.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/misc-utils/lsblk.c b/misc-utils/lsblk.c
index 915a062ba..c8683854c 100644
--- a/misc-utils/lsblk.c
+++ b/misc-utils/lsblk.c
@@ -1814,7 +1814,7 @@ int main(int argc, char *argv[])
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
lsblk = &_ls;
@@ -1849,9 +1849,6 @@ int main(int argc, char *argv[])
case 'e':
parse_excludes(optarg);
break;
- case 'h':
- usage();
- break;
case 'J':
lsblk->flags |= LSBLK_JSON;
break;
@@ -1939,9 +1936,6 @@ int main(int argc, char *argv[])
case OPT_SYSROOT:
lsblk->sysroot = optarg;
break;
- case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
case 'E':
lsblk->dedup_id = column_name_to_id(optarg, strlen(optarg));
if (lsblk->dedup_id >= 0)
@@ -1953,7 +1947,13 @@ int main(int argc, char *argv[])
lsblk->sort_id = column_name_to_id(optarg, strlen(optarg));
if (lsblk->sort_id >= 0)
break;
- /* fallthrough */
+ errtryhelp(EXIT_FAILURE);
+ break;
+
+ case 'h':
+ usage();
+ case 'V':
+ print_version(EXIT_SUCCESS);
default:
errtryhelp(EXIT_FAILURE);
}