summaryrefslogtreecommitdiffstats
path: root/schedutils
diff options
context:
space:
mode:
authorKarel Zak2019-04-16 15:14:13 +0200
committerKarel Zak2019-04-16 15:14:13 +0200
commit2c308875a7fa1aaa44892c368f6b37bcfcb8879a (patch)
tree157ea7afca59059676dbcc25133dd196d1e45fb8 /schedutils
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 'schedutils')
-rw-r--r--schedutils/chrt.c6
-rw-r--r--schedutils/ionice.c6
-rw-r--r--schedutils/taskset.c7
3 files changed, 9 insertions, 10 deletions
diff --git a/schedutils/chrt.c b/schedutils/chrt.c
index b08c78ed8..cc3a8c2f0 100644
--- a/schedutils/chrt.c
+++ b/schedutils/chrt.c
@@ -434,7 +434,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while((c = getopt_long(argc, argv, "+abdD:fiphmoP:T:rRvV", longopts, NULL)) != -1)
{
@@ -489,9 +489,9 @@ int main(int argc, char **argv)
case 'D':
ctl->deadline = strtou64_or_err(optarg, _("invalid deadline argument"));
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
diff --git a/schedutils/ionice.c b/schedutils/ionice.c
index b4c6a82a2..ae2c73ea5 100644
--- a/schedutils/ionice.c
+++ b/schedutils/ionice.c
@@ -149,7 +149,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
while ((c = getopt_long(argc, argv, "+n:c:p:P:u:tVh", longopts, NULL)) != EOF)
switch (c) {
@@ -197,9 +197,9 @@ int main(int argc, char **argv)
case 't':
tolerant = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
default:
diff --git a/schedutils/taskset.c b/schedutils/taskset.c
index fe79cd631..56db81792 100644
--- a/schedutils/taskset.c
+++ b/schedutils/taskset.c
@@ -157,7 +157,7 @@ int main(int argc, char **argv)
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
textdomain(PACKAGE);
- atexit(close_stdout);
+ close_stdout_atexit();
memset(&ts, 0, sizeof(ts));
@@ -173,12 +173,11 @@ int main(int argc, char **argv)
case 'c':
ts.use_list = 1;
break;
+
case 'V':
- printf(UTIL_LINUX_VERSION);
- return EXIT_SUCCESS;
+ print_version(EXIT_SUCCESS);
case 'h':
usage();
- break;
default:
errtryhelp(EXIT_FAILURE);
}