Skip to contentSkip to conversation

conga/ricci/common Module.cpp

Cluster-devel [email protected] 1 participant 1 message Jun 18, 2007

lore
Share & tools
lore
#0 lore raw

CVSROOT: /cvs/cluster
Module name: conga
Branch: EXPERIMENTAL
Changes by: rmccabe at sourceware.org 2007-06-18 03:54:09

Modified files:
ricci/common : Module.cpp

Log message:
duh.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/common/Module.cpp.diff?cvsroot=cluster&only_with_tag=EXPERIMENTAL&r1=1.5.8.2&r2=1.5.8.3

ricci/common/Module.cpp +10 -6
@@ -290,27 +290,31 @@
 		// process event
 		if (poll_data.revents & POLLIN) {
 			char buff[4096];
-			int ret = read(poll_data.fd, buff, sizeof(buff));
+			int ret;
+
+			ret = read(poll_data.fd, buff, sizeof(buff));
 			if (ret == -1) {
 				if (errno == EINTR)
 					continue;
 				throw String("error reading stdin: ") + String(strerror(errno));
 			}
 
+			if (ret > 0) {
+				data.append(buff, ret);
+				shred(buff, sizeof(buff));
+			}
+
 			if ((size_t) ret < sizeof(buff)) {
 				try {
-					data.append(buff, ret);
-					shred(buff, sizeof(buff));
 					XMLObject request = parseXML(data);
 					XMLObject response = module.process(request);
 					cout << generateXML(response) << endl;
 					return 0;
-				} catch ( ... ) {
-					shred(buff, sizeof(buff));
-				}
+				} catch ( ... ) { }
 			}
 			continue;
 		}
+
 		if (poll_data.revents & (POLLERR | POLLHUP | POLLNVAL))
 			throw String("stdin error: ") + String(strerror(errno));
 	} // while