diff options
author | Sami Kerola | 2016-04-16 18:54:25 +0200 |
---|---|---|
committer | Sami Kerola | 2016-04-17 00:09:26 +0200 |
commit | 22d5cc87e6ce0e492f0db3209d51c89b48c81d14 (patch) | |
tree | eb111bb54651d2a750c68b8b1aab9826a567010f /term-utils/script.c | |
parent | script: avoid trying fclose(NULL) (diff) | |
download | kernel-qcow2-util-linux-22d5cc87e6ce0e492f0db3209d51c89b48c81d14.tar.gz kernel-qcow2-util-linux-22d5cc87e6ce0e492f0db3209d51c89b48c81d14.tar.xz kernel-qcow2-util-linux-22d5cc87e6ce0e492f0db3209d51c89b48c81d14.zip |
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 <kerolasa@iki.fi>
Diffstat (limited to 'term-utils/script.c')
-rw-r--r-- | term-utils/script.c | 6 |
1 files changed, 4 insertions, 2 deletions
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)) |