_(recvfrom, ssize_t, (int, void *buf, size_t, int, \
struct sockaddr *from, socklen_t *fromlen)) \
_(sendmsg, ssize_t, (int, const struct msghdr *, int)) \
- _(recvmsg, ssize_t, (int, struct msghdr *, int)) \
- _(close, int, (int))
+ _(recvmsg, ssize_t, (int, struct msghdr *, int))
/* Function pointers to set up. */
#define DECL(imp, ret, args) static ret (*real_##imp) args;
{
char buf[INET_ADDRSTRLEN + 16];
char *p;
- size_t n = strlen(sockdir), nn = strlen(sun->sun_path);
+ size_t n = strlen(sockdir), nn;
struct sockaddr_in sin_mine;
unsigned long port;
sin = &sin_mine;
if (sun->sun_family != AF_UNIX)
return (-1);
+ nn = strlen(sun->sun_path);
if (len < sizeof(sun)) ((char *)sun)[len] = 0;
D( fprintf(stderr, "noip: decode (%d) `%s'",
*sun->sun_path, sun->sun_path); )
len = sizeof(ov_); \
if (real_getsockopt(sk, SOL_SOCKET, SO_##opt, &ov_, &len) < 0 || \
real_setsockopt(nsk, SOL_SOCKET, SO_##opt, &ov_, len)) { \
- real_close(nsk); \
+ close(nsk); \
return (-1); \
} \
} while (0);
(fd = fcntl(sk, F_GETFD)) < 0 ||
fcntl(nsk, F_SETFL, f) < 0 ||
dup2(nsk, sk) < 0) {
- real_close(nsk);
+ close(nsk);
return (-1);
}
unlink(sun.sun_path);
- real_close(nsk);
+ close(nsk);
if (fcntl(sk, F_SETFD, fd) < 0) {
perror("noip: fixup_real_ip_socket F_SETFD");
abort();
pf = PF_UNIX;
proto = 0;
case PF_UNIX:
+#ifdef PF_NETLINK
+ case PF_NETLINK:
+#endif
return real_socket(pf, ty, proto);
default:
errno = EAFNOSUPPORT;
int connect(int sk, const struct sockaddr *sa, socklen_t len)
{
struct sockaddr_un sun;
- int fixup_p = 0;
int rc;
switch (sa->sa_family) {
case AF_INET:
PRESERVING_ERRNO({
do_implicit_bind(sk, &sa, &len, &sun);
- fixup_p = 1;
});
rc = real_connect(sk, sa, len);
if (rc < 0) {
/* Print the given message to standard error. Avoids stdio. */
static void printerr(const char *p)
- { int hunoz; hunoz = write(STDERR_FILENO, p, strlen(p)); }
+ { if (write(STDERR_FILENO, p, strlen(p))) ; }
/* Create the socket directory, being careful about permissions. */
static void create_sockdir(void)