From mboxrd@z Thu Jan 1 00:00:00 1970 From: rmccabe@sourceware.org Date: 18 Jun 2007 03:54:10 -0000 Subject: [Cluster-devel] conga/ricci/common Module.cpp Message-ID: <20070618035410.23200.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 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 --- conga/ricci/common/Module.cpp 2007/06/02 04:28:48 1.5.8.2 +++ conga/ricci/common/Module.cpp 2007/06/18 03:54:09 1.5.8.3 @@ -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