texpect: Avoid duplicate sys_write()
authorVolker Lendecke <vl@samba.org>
Wed, 15 Jan 2020 11:40:38 +0000 (12:40 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 15 Jan 2020 21:25:34 +0000 (21:25 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
lib/texpect/texpect.c
lib/texpect/wscript

index 797f0a024b4a81fd3a2ba6e78400ac61652ebeab..8c9431e366ea9500a36e4fa903cbb9690b424672 100644 (file)
@@ -34,6 +34,7 @@
 #include "replace.h"
 #include "system/filesys.h"
 #include "system/wait.h"
+#include "lib/util/sys_rw.h"
 
 #ifdef HAVE_PTY_H
 #include <pty.h>
@@ -176,24 +177,6 @@ static char *iscmd(const char *buf, const char *s)
        return strdup(buf + len);
 }
 
-/*******************************************************************
-A write wrapper that will deal with EINTR.
-********************************************************************/
-
-static ssize_t sys_write(int fd, const void *buf, size_t count)
-{
-       ssize_t ret;
-
-       do {
-               ret = write(fd, buf, count);
-#if defined(EWOULDBLOCK)
-       } while (ret == -1 && (errno == EINTR || errno == EAGAIN || errno == EWOULDBLOCK));
-#else
-       } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
-#endif
-       return ret;
-}
-
 static void parse_configuration(const char *fn)
 {
        struct command *c;
index cf6071cd3c5c66781527a279f07f4dce2ae90cbb..44f92a85136668d68ee88f2ea32898d716ba32d9 100644 (file)
@@ -6,5 +6,5 @@ def configure(conf):
 def build(bld):
     bld.SAMBA_BINARY('texpect',
                      'texpect.c',
-                     deps='popt util replace',
+                     deps='popt util replace sys_rw',
                      for_selftest=True)