From ed8ec2a65d468b638d865d6fdafe0a249ca74c91 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Wed, 4 Apr 2012 19:51:32 +0200 Subject: [PATCH] schedutils: verify writing to streams was successful Signed-off-by: Sami Kerola --- schedutils/chrt.c | 3 ++- schedutils/ionice.c | 2 ++ schedutils/taskset.c | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/schedutils/chrt.c b/schedutils/chrt.c index 944cd77486..cbf2417e89 100644 --- a/schedutils/chrt.c +++ b/schedutils/chrt.c @@ -31,7 +31,7 @@ #include "c.h" #include "nls.h" - +#include "closestream.h" #include "strutils.h" #include "procutils.h" @@ -218,6 +218,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while((i = getopt_long(argc, argv, "+abfiphmoRrvV", longopts, NULL)) != -1) { diff --git a/schedutils/ionice.c b/schedutils/ionice.c index 18529753f4..5fdeccf8de 100644 --- a/schedutils/ionice.c +++ b/schedutils/ionice.c @@ -17,6 +17,7 @@ #include "nls.h" #include "strutils.h" #include "c.h" +#include "closestream.h" static int tolerant; @@ -139,6 +140,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); while ((c = getopt_long(argc, argv, "+n:c:p:tVh", longopts, NULL)) != EOF) switch (c) { diff --git a/schedutils/taskset.c b/schedutils/taskset.c index b7aee5064d..908ac8e2d8 100644 --- a/schedutils/taskset.c +++ b/schedutils/taskset.c @@ -34,6 +34,7 @@ #include "xalloc.h" #include "procutils.h" #include "c.h" +#include "closestream.h" struct taskset { pid_t pid; /* task PID */ @@ -146,6 +147,7 @@ int main(int argc, char **argv) setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); + atexit(close_stdout); memset(&ts, 0, sizeof(ts)); -- 2.47.3