+ /*
+ * 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(100, "Run program fgets killed=%d\n", bpipe->timer_id->killed);
+ pm_strcpy(tmp, _("Program killed by Bacula (timeout)\n"));
+ stat1 = ETIME;
+ }
+ pm_strcpy(results, tmp);
+ Dmsg3(200, "resadr=0x%x reslen=%d res=%s\n", results, strlen(results), results);
+ stat2 = close_bpipe(bpipe);
+ stat1 = stat2 != 0 ? stat2 : stat1;
+
+ Dmsg1(100, "Run program returning %d\n", stat1);
+bail_out:
+ free_pool_memory(tmp);
+ free(buf);
+ return stat1;