cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
* [Cluster-devel] conga/ricci/ricci RicciWorker.cpp
@ 2008-01-24  6:14 rmccabe
  0 siblings, 0 replies; only message in thread
From: rmccabe @ 2008-01-24  6:14 UTC (permalink / raw)
  To: cluster-devel.redhat.com

CVSROOT:	/cvs/cluster
Module name:	conga
Changes by:	rmccabe at sourceware.org	2008-01-24 06:14:37

Modified files:
	ricci/ricci    : RicciWorker.cpp 

Log message:
	Fix stupid bug that caused reading batch jobs with XML longer than 4k to fail.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/conga/ricci/ricci/RicciWorker.cpp.diff?cvsroot=cluster&r1=1.16&r2=1.17

--- conga/ricci/ricci/RicciWorker.cpp	2008/01/02 20:47:38	1.16
+++ conga/ricci/ricci/RicciWorker.cpp	2008/01/24 06:14:37	1.17
@@ -258,6 +258,7 @@
 	_path(path)
 {
 	QueueLocker lock;
+	struct stat st;
 
 	_fd = open(_path.c_str(), O_RDONLY);
 	if (_fd == -1)
@@ -276,18 +277,24 @@
 			}
 		}
 
+		if (fstat(_fd, &st) != 0)
+			throw String("Unable to stat file: ") + String(strerror(errno));
+
 		// read file
 		String xml_str;
-		char buff[4096];
-		ssize_t res;
 
-		res = read_restart(_fd, buff, sizeof(buff));
-		if (res <= 0) {
-			throw String("error reading batch file: ")
+		while ((off_t) xml_str.size() < st.st_size) {
+			char buff[4096];
+			ssize_t res;
+
+			res = read_restart(_fd, buff, sizeof(buff));
+			if (res <= 0) {
+				throw String("error reading batch file: ")
 					+ String(strerror(-res));
+			}
+			xml_str.append(buff, res);
+			memset(buff, 0, sizeof(buff));
 		}
-		xml_str.append(buff, res);
-		memset(buff, 0, sizeof(buff));
 
 		// _xml
 		_xml = parseXML(xml_str);



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-24  6:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-24  6:14 [Cluster-devel] conga/ricci/ricci RicciWorker.cpp rmccabe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).