summaryrefslogtreecommitdiffstats
path: root/misc-utils
diff options
context:
space:
mode:
authorKarel Zak2019-04-16 13:47:17 +0200
committerKarel Zak2019-04-16 13:47:17 +0200
commit68224d108d1e5359a111cb2be0404f6556cb90dd (patch)
tree4d956d4d580dd6ceac9e7a23469a914780d115ac /misc-utils
parentinclude/closestream: add close_stdout_atexit() (diff)
downloadkernel-qcow2-util-linux-68224d108d1e5359a111cb2be0404f6556cb90dd.tar.gz
kernel-qcow2-util-linux-68224d108d1e5359a111cb2be0404f6556cb90dd.tar.xz
kernel-qcow2-util-linux-68224d108d1e5359a111cb2be0404f6556cb90dd.zip
include/c: add print_version() macro
Let's consolidate the version printing code. It also seems better to use exit() after --version, because it's handled in different way by ASAN. It's strange, but ASAN reports leaks after return in main(). Note that we do not use free-before-exit. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'misc-utils')
-rw-r--r--misc-utils/blkid.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/misc-utils/blkid.c b/misc-utils/blkid.c
index e94edfcf2..c03e1bb8d 100644
--- a/misc-utils/blkid.c
+++ b/misc-utils/blkid.c
@@ -62,13 +62,6 @@ struct blkid_control {
raw_chars:1;
};
-static void print_version(FILE *out)
-{
- fprintf(out, _("%s from %s (libblkid %s, %s)\n"),
- program_invocation_short_name, PACKAGE_STRING,
- LIBBLKID_VERSION, LIBBLKID_DATE);
-}
-
static void __attribute__((__noreturn__)) usage(void)
{
FILE *out = stdout;
@@ -793,7 +786,9 @@ int main(int argc, char **argv)
break;
case 'V':
case 'v':
- print_version(stdout);
+ fprintf(stdout, _("%s from %s (libblkid %s, %s)\n"),
+ program_invocation_short_name, PACKAGE_STRING,
+ LIBBLKID_VERSION, LIBBLKID_DATE);
err = 0;
goto exit;
case 'w':