- len += count;
- if (len >= ressize-1) {
- err("ressize %ld too short", (long)ressize);
- retval = -1;
- break;
+ count = read(outpipe[0], inbuf, sizeof(inbuf)-1);
+ if (count <= 0) {
+ close(outpipe[0]);
+ outpipe[0] = -1;
+ if (count < 0) {
+ err("stdin read failed with '%s'", strerror(errno));
+ retval = -1;
+ }
+ continue;
+ }
+ inbuf[count] = '\0';
+
+ /* store result for rule processing */
+ if (result) {
+ if (respos + count < ressize) {
+ memcpy(&result[respos], inbuf, count);
+ respos += count;
+ } else {
+ err("ressize %ld too short", (long)ressize);
+ retval = -1;
+ }
+ }
+ pos = inbuf;
+ while ((line = strsep(&pos, "\n")))
+ if (pos || line[0] != '\0')
+ info("'%s' (stdout) '%s'", argv[0], line);