[PATCH 3/7] uuidd: use write_all from include/writeall.h

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

 



Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
 misc-utils/uuidd.c |   22 ++--------------------
 1 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/misc-utils/uuidd.c b/misc-utils/uuidd.c
index f61c8cd..b7e97b7 100644
--- a/misc-utils/uuidd.c
+++ b/misc-utils/uuidd.c
@@ -32,6 +32,7 @@ extern int optind;
 
 #include "uuid.h"
 #include "uuidd.h"
+#include "writeall.h"
 
 #include "nls.h"
 
@@ -93,25 +94,6 @@ static ssize_t read_all(int fd, char *buf, size_t count)
 	return c;
 }
 
-static int write_all(int fd, char *buf, size_t count)
-{
-	ssize_t ret;
-	int c = 0;
-
-	while (count > 0) {
-		ret = write(fd, buf, count);
-		if (ret < 0) {
-			if ((errno == EAGAIN) || (errno == EINTR))
-				continue;
-			return -1;
-		}
-		count -= ret;
-		buf += ret;
-		c += ret;
-	}
-	return c;
-}
-
 static const char *cleanup_pidfile, *cleanup_socket;
 
 static void terminate_intr(int signo CODE_ATTR((unused)))
@@ -171,7 +153,7 @@ static int call_daemon(const char *socket_path, int op, char *buf,
 	}
 
 	ret = write_all(s, op_buf, op_len);
-	if (ret < op_len) {
+	if (ret < 0) {
 		if (err_context)
 			*err_context = _("write");
 		close(s);
-- 
1.7.1

--
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