+ /*
+ * We always check whether the timer killed the program. We would see
+ * an eof even when it does so we just have to trust the killed flag
+ * and set the timer values to avoid edge cases where the program ends
+ * just as the timer kills it.
+ */
+ if (bpipe->timer_id && bpipe->timer_id->killed) {
+ Dmsg1(150, "Run program fgets killed=%d\n", bpipe->timer_id->killed);
+ pm_strcat(tmp, _("Program killed by Bacula watchdog (timeout)\n"));
+ stat1 = ETIME;
+ }
+ int len = sizeof_pool_memory(results) - 1;
+ bstrncpy(results, tmp, len);
+ Dmsg3(1900, "resadr=0x%x reslen=%d res=%s\n", results, strlen(results), results);
+ stat2 = close_bpipe(bpipe);
+ stat1 = stat2 != 0 ? stat2 : stat1;
+
+ Dmsg1(900, "Run program returning %d\n", stat1);
+ free_pool_memory(tmp);
+ free(buf);
+ return stat1;