X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Ftools.c;h=77349d93c33b463e4dc5e18617d90d5229f497b4;hp=c8697320a9fd5616c5dfa1e04af686efec0c1a87;hb=d0d65608c45c7c73bdd6cf57d7f7c44c402dc03a;hpb=af5b1a18948345c5f9f9abf4eda3ab9fe0aa9a9f diff --git a/tools/tools.c b/tools/tools.c index c8697320..77349d93 100644 --- a/tools/tools.c +++ b/tools/tools.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -13,7 +14,6 @@ #include #include #include -#include #include #include #include @@ -73,7 +73,7 @@ char *run_with_timeout(const void *ctx, const char *cmd, int p[2]; char *ret; int status, ms; - struct timeval start; + struct timespec start; *ok = false; if (pipe(p) != 0) @@ -92,7 +92,6 @@ char *run_with_timeout(const void *ctx, const char *cmd, close_noerr(p[1]); return talloc_asprintf(ctx, "Failed to fork: %s", strerror(errno)); - return NULL; } if (pid == 0) { @@ -107,7 +106,7 @@ char *run_with_timeout(const void *ctx, const char *cmd, signal(SIGALRM, killme); itim.it_interval.tv_sec = itim.it_interval.tv_usec = 0; - itim.it_value = time_from_msec(*timeout_ms); + itim.it_value = timespec_to_timeval(time_from_msec(*timeout_ms)); setitimer(ITIMER_REAL, &itim, NULL); status = system(cmd);