}
if (addr->sa.sa_family == AF_UNIX) {
- struct sockaddr_un sun;
+ struct sockaddr_un sa_un;
/* Construct path of our socket. Use the same directory as the server
socket and include our process ID to allow multiple chronyc instances
running at the same time. */
dir = UTI_PathToDir(addr->un.sun_path);
- if (snprintf(sun.sun_path, sizeof (sun.sun_path),
- "%s/chronyc.%d.sock", dir, getpid()) >= sizeof (sun.sun_path))
+ if (snprintf(sa_un.sun_path, sizeof (sa_un.sun_path),
+ "%s/chronyc.%d.sock", dir, (int)getpid()) >= sizeof (sa_un.sun_path))
LOG_FATAL(LOGF_Client, "Unix socket path too long");
Free(dir);
- sun.sun_family = AF_UNIX;
- unlink(sun.sun_path);
+ sa_un.sun_family = AF_UNIX;
+ unlink(sa_un.sun_path);
/* Bind the socket to the path */
- if (bind(sock_fd, (struct sockaddr *)&sun, sizeof (sun)) < 0) {
+ if (bind(sock_fd, (struct sockaddr *)&sa_un, sizeof (sa_un)) < 0) {
DEBUG_LOG(LOGF_Client, "Could not bind socket : %s", strerror(errno));
return 0;
}
/* Allow server without root privileges to send replies to our socket */
- if (chmod(sun.sun_path, 0666) < 0) {
+ if (chmod(sa_un.sun_path, 0666) < 0) {
DEBUG_LOG(LOGF_Client, "Could not change socket permissions : %s", strerror(errno));
return 0;
}
# Doug Woodward <dougw@whistler.com> reported that this configuration
# works for Solaris 2.8 / SunOS 5.8 on x86 platforms
EXTRA_OBJECTS="sys_solaris.o"
- EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf"
- EXTRA_CLI_LIBS="-lsocket -lnsl"
+ EXTRA_LIBS="-lsocket -lnsl -lkvm -lelf -lresolv"
+ EXTRA_CLI_LIBS="-lsocket -lnsl -lresolv"
add_def SOLARIS
+ # These are needed to have msg_control in struct msghdr
+ add_def __EXTENSIONS__
+ add_def _XOPEN_SOURCE 1
+ add_def _XOPEN_SOURCE_EXTENDED 1
echo "Configuring for Solaris (" $SYSTEM "SunOS version" $VERSION ")"
;;
* )
fi
if [ $feat_ipv6 = "1" ] && \
- test_code 'IPv6 support' 'arpa/inet.h sys/socket.h netinet/in.h' '' '' '
+ test_code 'IPv6 support' 'arpa/inet.h sys/socket.h netinet/in.h' '' "$EXTRA_LIBS" '
struct sockaddr_in6 n;
char p[100];
n.sin6_addr = in6addr_any;
fi
fi
-if test_code 'getaddrinfo()' 'sys/types.h sys/socket.h netdb.h' '' '' \
+if test_code 'getaddrinfo()' 'sys/types.h sys/socket.h netdb.h' '' "$EXTRA_LIBS" \
'return getaddrinfo(0, 0, 0, 0);'
then
add_def HAVE_GETADDRINFO
if (!out) {
LOG_FATAL(LOGF_Main, "could not open lockfile %s for writing", pidfile);
} else {
- fprintf(out, "%d\n", getpid());
+ fprintf(out, "%d\n", (int)getpid());
fclose(out);
}
}