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