[PATCH 5/7] script: check status of writes when closing outputs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This should make possible output issues more obvious, for example when a
disk will get full.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 term-utils/script.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/term-utils/script.c b/term-utils/script.c
index d691c22..d2eaafb 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))
-- 
2.8.0

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux