X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/64370837e6201342a0f41f84aaf0ce106a8635d0..cca89d7ce589d10a226c6dfa212e36cbcad25fd2:/lib/addr.c diff --git a/lib/addr.c b/lib/addr.c index 052466c..f23da74 100644 --- a/lib/addr.c +++ b/lib/addr.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder. - * Copyright (C) 2004, 2007, 2008 Richard Kettlewell + * Copyright (C) 2004, 2007, 2008, 2013 Richard Kettlewell * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,10 +21,18 @@ #include "common.h" #include -#include -#include -#include -#include +#if HAVE_SYS_SOCKET_H +# include +#endif +#if HAVE_NETINET_IN_H +# include +#endif +#if HAVE_ARPA_INET_H +# include +#endif +#if HAVE_SYS_UN_H +# include +#endif #include "log.h" #include "printf.h" @@ -185,10 +193,12 @@ static inline char *format_sockaddr6(const struct sockaddr_in6 *sin6) { return r; } +#if HAVE_SYS_UN_H /** @brief Format a UNIX socket address */ static inline char *format_sockaddrun(const struct sockaddr_un *sun) { return xstrdup(sun->sun_path); } +#endif /** @brief Construct a text description a sockaddr * @param sa Socket address @@ -200,8 +210,10 @@ char *format_sockaddr(const struct sockaddr *sa) { return format_sockaddr4((const struct sockaddr_in *)sa); case AF_INET6: return format_sockaddr6((const struct sockaddr_in6 *)sa); +#if HAVE_SYS_UN_H case AF_UNIX: return format_sockaddrun((const struct sockaddr_un *)sa); +#endif default: return 0; }