#include <sys/wait.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
#include <err.h>
const void *ctx;
};
-static void killme(int sig)
+static void killme(int sig UNNEEDED)
{
kill(-getpid(), SIGKILL);
}
signal(SIGALRM, killme);
itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0;
- itim.it_value = timespec_to_timeval(time_from_msec(c->time_ms));
+ itim.it_value = timespec_to_timeval(time_from_msec(c->time_ms).ts);
setitimer(ITIMER_REAL, &itim, NULL);
c->status = system(c->command);
int old_len, len;
/* This length includes nul terminator! */
old_len = tal_count(c->output);
- tal_resize(&c->output, old_len + 1024);
- len = read(c->output_fd, c->output + old_len - 1, 1024);
+ tal_resize(&c->output, old_len + 65536);
+ len = read(c->output_fd, c->output + old_len - 1, 65536);
if (len < 0)
err(1, "Reading from async command");
- tal_resize(&c->output, old_len + len);
+ if (len != 65536)
+ tal_resize(&c->output, old_len + len);
c->output[old_len + len - 1] = '\0';
if (len == 0) {
struct rusage ru;