#include <sys/types.h>
#include <netdb.h>
#include <sys/ioctl.h>
-#ifdef vms
+#ifdef __VMS__
+#define SOCK_LEN_TYP (unsigned int*)
#include <socket.h>
+struct sockaddr_un {
+ u_char sun_len; /* sockaddr len including null */
+ u_char sun_family; /* AF_UNIX */
+ char sun_path[108]; /* path name (gag) */
+};
#else
#include <sys/socket.h>
-#endif
#include <sys/un.h>
+#define SOCK_LEN_TYP (int*)
+#endif
#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
size = sizeof(addr);
- if (getsockname(socket->m_fd, &addr, &size) < 0) {
+ if (getsockname(socket->m_fd, &addr, SOCK_LEN_TYP &size) < 0) {
socket->m_error = GSOCK_IOERR;
return NULL;
}
fromlen = sizeof(from);
MASK_SIGNAL();
- ret = recvfrom(socket->m_fd, buffer, size, 0, &from, &fromlen);
+ ret = recvfrom(socket->m_fd, buffer, size, 0, &from,
+ SOCK_LEN_TYP &fromlen);
UNMASK_SIGNAL();
if (ret == -1)
socket->m_establishing = FALSE;
len = sizeof(error);
- getsockopt(socket->m_fd, SOL_SOCKET, SO_ERROR, (void*) &error, &len);
+ getsockopt(socket->m_fd, SOL_SOCKET, SO_ERROR, (void*) &error,
+ SOCK_LEN_TYP &len);
if (error)
{
address->m_family = GSOCK_INET;
address->m_realfamily = PF_INET;
((struct sockaddr_in *)address->m_addr)->sin_family = AF_INET;
- ((struct sockaddr_in *)address->m_addr)->sin_addr.s_addr = INADDR_ANY;
+ /*
+ INADDR_BROADCAST is identical to INADDR_NONE which is not defined
+ on all unices. INADDR_BROADCAST should be fine to indicate an error.
+ */
+ ((struct sockaddr_in *)address->m_addr)->sin_addr.s_addr = INADDR_BROADCAST;
return GSOCK_NOERROR;
}