From 22d5cc87e6ce0e492f0db3209d51c89b48c81d14 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Sat, 16 Apr 2016 17:54:25 +0100 Subject: script: check status of writes when closing outputs This should make possible output issues more obvious, for example when a disk will get full. Signed-off-by: Sami Kerola --- term-utils/script.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'term-utils') diff --git a/term-utils/script.c b/term-utils/script.c index d691c2231..d2eaafb8f 100644 --- a/term-utils/script.c +++ b/term-utils/script.c @@ -204,9 +204,11 @@ static void __attribute__((__noreturn__)) done(struct script_control *ctl) kill(ctl->child, SIGTERM); /* make sure we don't create orphans */ if (ctl->timingfp) - fclose(ctl->timingfp); + if (close_stream(ctl->timingfp) != 0) + err(EXIT_FAILURE, "write failed: %s", ctl->tname); if (ctl->typescriptfp) - fclose(ctl->typescriptfp); + if (close_stream(ctl->typescriptfp) != 0) + err(EXIT_FAILURE, "write failed: %s", ctl->fname); if (ctl->rc_wanted) { if (WIFSIGNALED(ctl->childstatus)) -- cgit v1.2.3-55-g7522