From c5efd674fe3437e288028f284f88333e4ba284a2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fredrik=20H=C3=BCbinette=20=28Hubbe=29?= <hubbe@hubbe.net>
Date: Sun, 18 Feb 1996 02:30:06 +0100
Subject: [PATCH] write now does what it should, ie. EINTR retries

Rev: src/modules/files/file.c:1.11
---
 src/modules/files/file.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/modules/files/file.c b/src/modules/files/file.c
index d025a859cd..d5bef66d8e 100644
--- a/src/modules/files/file.c
+++ b/src/modules/files/file.c
@@ -305,8 +305,7 @@ static void file_write_callback(int fd, void *data)
 
 static void file_write(INT32 args)
 {
-  INT32 written;
-  char *out;
+  INT32 written,i;
 
   if(args<1 || sp[-args].type != T_STRING)
     error("Bad argument 1 to file->write().\n");
@@ -317,7 +316,7 @@ static void file_write(INT32 args)
   written=0;
   while(written < sp[-args].u.string->len)
   {
-    i=write(FD, sp[-args].u.string->str, sp[-args].u.string->len);
+    i=write(FD, sp[-args].u.string->str + written, sp[-args].u.string->len - written);
 
     if(i<0)
     {
@@ -345,7 +344,7 @@ static void file_write(INT32 args)
   THIS->errno=0;
 
   pop_n_elems(args);
-  push_int(i);
+  push_int(written);
 }
 
 static void do_close(int fd, int flags)
-- 
GitLab