1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-06-23 06:25:25 +00:00

Karl's patch for freebsd, minus the sys/select.h test which breaks on OS X.

Also enables IPV6 in libshout!

svn path=/trunk/httpp/; revision=4884
This commit is contained in:
brendan 2003-06-05 17:09:12 +00:00
parent a9419adb1a
commit ced88f98a8
3 changed files with 8 additions and 10 deletions

View File

@ -12,6 +12,9 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#include <avl/avl.h>
#include "httpp.h"

View File

@ -92,7 +92,7 @@ char *sock_get_localip(char *buff, int len)
{
char temp[1024];
if (gethostname(temp, 1024) != 0)
if (gethostname(temp, sizeof(temp)) != 0)
return NULL;
if (resolver_getip(temp, buff, len))
@ -588,7 +588,7 @@ sock_t sock_connect_wto(const char *hostname, const int port, const int timeout)
*/
sock_t sock_get_server_socket(const int port, char *sinterface)
{
#ifdef HAVE_IPV6
#ifdef HAVE_INET_PTON
struct sockaddr_storage sa;
#else
struct sockaddr_in sa;
@ -610,7 +610,7 @@ sock_t sock_get_server_socket(const int port, char *sinterface)
if (!resolver_getip(sinterface, ip, sizeof (ip)))
return SOCK_ERROR;
#ifdef HAVE_IPV6
#ifdef HAVE_INET_PTON
if (inet_pton(AF_INET, ip, &((struct sockaddr_in*)&sa)->sin_addr) > 0) {
((struct sockaddr_in*)&sa)->sin_family = AF_INET;
((struct sockaddr_in*)&sa)->sin_port = htons(port);
@ -667,7 +667,7 @@ int sock_listen(sock_t serversock, int backlog)
int sock_accept(sock_t serversock, char *ip, int len)
{
#ifdef HAVE_IPV6
#ifdef HAVE_INET_PTON
struct sockaddr_storage sa;
#else
struct sockaddr_in sa;
@ -682,7 +682,7 @@ int sock_accept(sock_t serversock, char *ip, int len)
ret = accept(serversock, (struct sockaddr *)&sa, &slen);
if (ret >= 0 && ip != NULL) {
#ifdef HAVE_IPV6
#ifdef HAVE_INET_PTON
if(((struct sockaddr_in *)&sa)->sin_family == AF_INET)
inet_ntop(AF_INET, &((struct sockaddr_in *)&sa)->sin_addr,
ip, len);

View File

@ -107,8 +107,3 @@ int inet_aton(const char *s, struct in_addr *a);
#endif
#endif /* __SOCK_H */