]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
script: check status of writes when closing outputs
authorSami Kerola <kerolasa@iki.fi>
Sat, 16 Apr 2016 16:54:25 +0000 (17:54 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 16 Apr 2016 22:09:26 +0000 (23:09 +0100)
This should make possible output issues more obvious, for example when a
disk will get full.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
term-utils/script.c

index d691c2231aa7e828880a8005f0c69410bb472de1..d2eaafb8f8649bbba2cd2f008894302c8e075ac3 100644 (file)
@@ -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))