|
|
304038 |
From 214d0ef6ac63442c285dd5d9d54190c62faf50d7 Mon Sep 17 00:00:00 2001
|
|
|
304038 |
From: Karel Zak <kzak@redhat.com>
|
|
|
304038 |
Date: Mon, 16 Oct 2017 13:30:44 +0200
|
|
|
304038 |
Subject: [PATCH 133/135] script: use all-io to write
|
|
|
304038 |
|
|
|
304038 |
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1427500
|
|
|
304038 |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
304038 |
---
|
|
|
304038 |
term-utils/script.c | 12 ++++--------
|
|
|
304038 |
1 file changed, 4 insertions(+), 8 deletions(-)
|
|
|
304038 |
|
|
|
304038 |
diff --git a/term-utils/script.c b/term-utils/script.c
|
|
|
304038 |
index 242b8154a..5840b600d 100644
|
|
|
304038 |
--- a/term-utils/script.c
|
|
|
304038 |
+++ b/term-utils/script.c
|
|
|
304038 |
@@ -62,6 +62,7 @@
|
|
|
304038 |
#include "closestream.h"
|
|
|
304038 |
#include "nls.h"
|
|
|
304038 |
#include "c.h"
|
|
|
304038 |
+#include "all-io.h"
|
|
|
304038 |
|
|
|
304038 |
#if defined(HAVE_LIBUTIL) && defined(HAVE_PTY_H)
|
|
|
304038 |
# include <pty.h>
|
|
|
304038 |
@@ -301,8 +302,7 @@ doinput(void) {
|
|
|
304038 |
|
|
|
304038 |
while (die == 0) {
|
|
|
304038 |
if ((cc = read(STDIN_FILENO, ibuf, BUFSIZ)) > 0) {
|
|
|
304038 |
- ssize_t wrt = write(master, ibuf, cc);
|
|
|
304038 |
- if (wrt < 0) {
|
|
|
304038 |
+ if (write_all(master, ibuf, cc)) {
|
|
|
304038 |
warn (_("write failed"));
|
|
|
304038 |
fail();
|
|
|
304038 |
}
|
|
|
304038 |
@@ -355,8 +355,6 @@ dooutput(FILE *timingfd) {
|
|
|
304038 |
struct timeval tv;
|
|
|
304038 |
double oldtime=time(NULL), newtime;
|
|
|
304038 |
int flgs = 0;
|
|
|
304038 |
- ssize_t wrt;
|
|
|
304038 |
- ssize_t fwrt;
|
|
|
304038 |
|
|
|
304038 |
close(STDIN_FILENO);
|
|
|
304038 |
#ifdef HAVE_LIBUTIL
|
|
|
304038 |
@@ -393,13 +391,11 @@ dooutput(FILE *timingfd) {
|
|
|
304038 |
fprintf(timingfd, "%f %zd\n", newtime - oldtime, cc);
|
|
|
304038 |
oldtime = newtime;
|
|
|
304038 |
}
|
|
|
304038 |
- wrt = write(STDOUT_FILENO, obuf, cc);
|
|
|
304038 |
- if (wrt < 0) {
|
|
|
304038 |
+ if (write_all(STDOUT_FILENO, obuf, cc)) {
|
|
|
304038 |
warn (_("write failed"));
|
|
|
304038 |
fail();
|
|
|
304038 |
}
|
|
|
304038 |
- fwrt = fwrite(obuf, 1, cc, fscript);
|
|
|
304038 |
- if (fwrt < cc) {
|
|
|
304038 |
+ if (fwrite_all(obuf, 1, cc, fscript)) {
|
|
|
304038 |
warn (_("cannot write script file"));
|
|
|
304038 |
fail();
|
|
|
304038 |
}
|
|
|
304038 |
--
|
|
|
304038 |
2.13.6
|
|
|
304038 |
|