noip.c, uopen.c: Provide fallback implementation of `SUN_LEN'.
[preload-hacks] / noip.c
diff --git a/noip.c b/noip.c
index f60788e..b9c040b 100644 (file)
--- a/noip.c
+++ b/noip.c
 #include <ifaddrs.h>
 #include <netdb.h>
 
+#ifndef SUN_LEN
+#  define SUN_LEN (sun) \
+       (strlen((sun)->sun_path) + offsetof(struct sockaddr_un, sun_path))
+#endif
+
 /*----- Data structures ---------------------------------------------------*/
 
 /* Unix socket status values. */
@@ -1965,7 +1970,7 @@ int getpeername(int sk, struct sockaddr *sa, socklen_t *len)
     D( fprintf(stderr, "noip(%d): ... GETPEERNAME", pid); )
   }
   D( dump_addrresult(rc, sa, *len); )
-  return (0);
+  return (rc);
 }
 
 int getsockopt(int sk, int lev, int opt, void *p, socklen_t *len)