summaryrefslogtreecommitdiff
path: root/Xtranssock.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu.herrb@laas.fr>2008-05-24 16:57:29 +0200
committerMatthieu Herrb <matthieu@bluenote.herrb.net>2008-05-24 16:57:29 +0200
commitf79638411463f81b35d984f249d0f339e28fb712 (patch)
tree99f5db42b59051777f4a88e5fabe5a7b59970f72 /Xtranssock.c
parente8037cb7783adf92791e57867456cfba7b01bcd1 (diff)
OpenBSD fixes: snprintf/strlc{at,py}
Diffstat (limited to 'Xtranssock.c')
-rw-r--r--Xtranssock.c19
1 files changed, 4 insertions, 15 deletions
diff --git a/Xtranssock.c b/Xtranssock.c
index 309839c..6b90040 100644
--- a/Xtranssock.c
+++ b/Xtranssock.c
@@ -296,9 +296,6 @@ static int TRANS(SocketINETClose) (XtransConnInfo ciptr);
#if defined(IPv6) && defined(AF_INET6)
static const struct in6_addr local_in6addr_any = IN6ADDR_ANY_INIT;
#pragma weak in6addr_any = local_in6addr_any
-#ifndef __USLC__
-#pragma weak getaddrinfo
-#endif
static int haveIPv6 = 1;
#endif
@@ -469,9 +466,6 @@ TRANS(SocketOpen) (int i, int type)
PRMSG (3,"SocketOpen(%d,%d)\n", i, type, 0);
#if defined(IPv6) && defined(AF_INET6)
- if (getaddrinfo == NULL)
- haveIPv6 = 0;
-
if (!haveIPv6 && Sockettrans2devtab[i].family == AF_INET6)
return NULL;
#endif
@@ -905,7 +899,7 @@ set_sun_path(const char *port, const char *upath, char *path, int abstract)
if (strlen(port) + strlen(upath) > maxlen)
return -1;
- sprintf(path, "%s%s%s", at, upath, port);
+ snprintf(path, "%s%s%s", maxlen+1, at, upath, port);
return 0;
}
#endif
@@ -1026,7 +1020,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
{
/* fixup the server port address */
tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
- sprintf (portbuf,"%lu", tmpport);
+ snprintf (portbuf, sizeof(portbuf), "%lu", tmpport);
port = portbuf;
}
#endif
@@ -1078,7 +1072,7 @@ TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, char *port, unsigned int
} else {
namelen = sizeof (struct sockaddr_in6);
#ifdef SIN6_LEN
- ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname);
+ ((struct sockaddr_in6 *)&sockname)->sin6_len = (u_int8_t)sizeof(sockname);
#endif
((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6;
((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport);
@@ -1531,7 +1525,7 @@ TRANS(SocketINETConnect) (XtransConnInfo ciptr, char *host, char *port)
if (is_numeric (port))
{
tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10);
- sprintf (portbuf, "%lu", tmpport);
+ snprintf (portbuf, sizeof(portbuf), "%lu", tmpport);
port = portbuf;
}
#endif
@@ -1888,11 +1882,6 @@ UnixHostReallyLocal (char *host)
{
char hostnamebuf[256];
-#if defined(IPv6) && defined(AF_INET6)
- if (getaddrinfo == NULL)
- haveIPv6 = 0;
-#endif
-
TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf));
if (strcmp (hostnamebuf, host) == 0)