Skip to content

Commit

Permalink
ccan: update so ccan/io doesn't exit when we get signals.
Browse files Browse the repository at this point in the history
In particular, we're going to capture SIGUSR1.

Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Feb 7, 2018
1 parent 00a874d commit 736a80d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ccan/README
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
CCAN imported from http://ccodearchive.net.

CCAN version: init-2398-g7082f7d0
CCAN version: init-2401-ge2d15a2b
7 changes: 6 additions & 1 deletion ccan/ccan/io/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,13 @@ void *io_loop(struct timers *timers, struct timer **expired)
}

r = pollfn(pollfds, num_fds, ms_timeout);
if (r < 0)
if (r < 0) {
/* Signals shouldn't break us, unless they set
* io_loop_return. */
if (errno == EINTR)
continue;
break;
}

for (i = 0; i < num_fds && !io_loop_return; i++) {
struct io_conn *c = (void *)fds[i];
Expand Down
2 changes: 2 additions & 0 deletions ccan/ccan/opt/usage.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
#include <sys/ioctl.h>
#include <sys/termios.h> /* Required on Solaris for struct winsize */
#endif
#if HAVE_SYS_UNISTD_H
#include <sys/unistd.h> /* Required on Solaris for ioctl */
#endif
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
Expand Down
2 changes: 1 addition & 1 deletion ccan/ccan/tal/path/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ char *path_join(const tal_t *ctx, const char *base, const char *a)
ret = tal_dup_arr(ctx, char, base, len, 1 + strlen(a) + 1);
if (!ret)
goto out;
if (ret[len-1] != PATH_SEP)
if (len != 0 && ret[len-1] != PATH_SEP)
ret[len++] = PATH_SEP;
strcpy(ret + len, a);

Expand Down
7 changes: 6 additions & 1 deletion ccan/ccan/tal/path/test/run-join.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ int main(void)
{
char *path, *ctx = tal_strdup(NULL, "ctx");

plan_tests(34);
plan_tests(36);

path = path_join(ctx, "foo", "bar");
ok1(streq(path, "foo/bar"));
Expand Down Expand Up @@ -85,6 +85,11 @@ int main(void)
ok1(!path);
ok1(!tal_first(ctx));

path = path_join(ctx, "", "bar");
ok1(streq(path, "bar"));
ok1(tal_parent(path) == ctx);
tal_free(path);

tal_free(ctx);

return exit_status();
Expand Down
2 changes: 2 additions & 0 deletions ccan/tools/configurator/configurator.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ static struct test tests[] = {
"#include <sys/filio.h>\n" },
{ "HAVE_SYS_TERMIOS_H", OUTSIDE_MAIN, NULL, NULL,
"#include <sys/termios.h>\n" },
{ "HAVE_SYS_UNISTD_H", OUTSIDE_MAIN, NULL, NULL,
"#include <sys/unistd.h>\n" },
{ "HAVE_TYPEOF", INSIDE_MAIN, NULL, NULL,
"__typeof__(argc) i; i = argc; return i == argc ? 0 : 1;" },
{ "HAVE_UNALIGNED_ACCESS", DEFINES_EVERYTHING|EXECUTE, NULL, NULL,
Expand Down

0 comments on commit 736a80d

Please sign in to comment.