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

[Cluster-devel] cluster/group/tool main.c



CVSROOT:	/cvs/cluster
Module name:	cluster
Branch: 	RHEL5
Changes by:	rpeterso sourceware org	2006-11-09 16:23:41

Modified files:
	group/tool     : main.c 

Log message:
	This is the fix for Bugzilla Bug 214524: group_tool dump can give
	short output.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/group/tool/main.c.diff?cvsroot=cluster&only_with_tag=RHEL5&r1=1.21.2.1&r2=1.21.2.2

--- cluster/group/tool/main.c	2006/11/09 15:51:01	1.21.2.1
+++ cluster/group/tool/main.c	2006/11/09 16:23:41	1.21.2.2
@@ -343,11 +343,17 @@
 		return -1;
 	}
 
-	rv = read(fd, inbuf, sizeof(inbuf));
-	if (rv <= 0)
-		printf("dump read returned %d errno %d\n", rv, errno);
-	else
-		write(STDOUT_FILENO, inbuf, rv);
+	while (1) {
+		rv = read(fd, inbuf, sizeof(inbuf));
+		fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+		if (rv <= 0) {
+			if (errno != EAGAIN)
+				printf("dump read returned %d errno %d\n", rv, errno);
+			break;
+		}
+		else
+			write(STDOUT_FILENO, inbuf, rv);
+	}
 
 	close(fd);
 	return 0;
@@ -370,11 +376,17 @@
 		return -1;
 	}
 
-	rv = read(fd, inbuf, sizeof(inbuf));
-	if (rv <= 0)
-		printf("dump read returned %d errno %d\n", rv, errno);
-	else
-		write(STDOUT_FILENO, inbuf, rv);
+	while (1) {
+		rv = read(fd, inbuf, sizeof(inbuf));
+		fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK);
+		if (rv <= 0) {
+			if (errno != EAGAIN)
+				printf("dump read returned %d errno %d\n", rv, errno);
+			break;
+		}
+		else
+			write(STDOUT_FILENO, inbuf, rv);
+	}
 
 	close(fd);
 	return 0;


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