diff options
author | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-12 00:44:37 +0200 |
---|---|---|
committer | Mikael Magnusson <mikma@users.sourceforge.net> | 2020-05-12 00:47:44 +0200 |
commit | 85b726a94c508a8a6b5fef28397257721033f8ca (patch) | |
tree | e8b389ba64efcbaae1a6d5c643c6340506adc4a2 | |
parent | c9c75c273b270c83d7c82bdeb5f26ac246644ff8 (diff) |
WIP unix socket debug 7
-rw-r--r-- | sysdep/unix/io.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sysdep/unix/io.c b/sysdep/unix/io.c index ba8ff5fc..aa86f62e 100644 --- a/sysdep/unix/io.c +++ b/sysdep/unix/io.c @@ -1529,8 +1529,12 @@ sk_connect_unix(sock *s, char *name, socklen_t namelen) struct sockaddr_un sa; int fd; - /* if (namelen > sizeof(sa.sun_path)) */ - /* return -1; */ + log(L_DEBUG, "sk_connect_unix %d %s", name[0], name + 1); + + if (namelen > sizeof(sa.sun_path)) + return -1; + + log(L_DEBUG, "sk_connect_unix 2"); /* We are sloppy during error (leak fd and not set s->err), but we die anyway */ @@ -1538,9 +1542,13 @@ sk_connect_unix(sock *s, char *name, socklen_t namelen) if (fd < 0) return -1; + log(L_DEBUG, "sk_connect_unix 3"); + if (fcntl(fd, F_SETFL, O_NONBLOCK) < 0) return -1; + log(L_DEBUG, "sk_connect_unix 4"); + /* Path length checked in test_old_bird() */ memset(&sa, 0, sizeof(sa)); sa.sun_family = AF_UNIX; @@ -1550,6 +1558,8 @@ sk_connect_unix(sock *s, char *name, socklen_t namelen) if (connect(fd, (struct sockaddr *) &sa, sizeof(sa.sun_family) + namelen) < 0) return -1; + log(L_DEBUG, "sk_connect_unix 5"); + s->fd = fd; s->type = SK_UNIX; sk_insert(s); |