applied John-Galt's patch of libixp/socket.c

This commit is contained in:
Anselm R. Garbe 2006-05-29 09:43:30 +02:00
parent b04617dae9
commit 0115b00394
2 changed files with 11 additions and 1 deletions

View File

@ -1,3 +1,4 @@
- remove snap-to-border for managed windows (is pointless).
- UTF8 fixes with iconv?
- re-introduce mouse based resizals (titlebar and border)
- idea for column mode:

View File

@ -107,6 +107,7 @@ create_inet_sock(char *host, char **errstr)
{
int fd;
struct sockaddr_in addr = { 0 };
struct hostent *hp;
char *port = strrchr(host, '!');
unsigned int prt;
@ -125,9 +126,17 @@ create_inet_sock(char *host, char **errstr)
return -1;
}
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = htonl(INADDR_ANY);
addr.sin_port = htons(prt);
if(!strncmp(host, "*", 1))
addr.sin_addr.s_addr = htonl(INADDR_ANY);
else if((hp = gethostbyname(host)))
bcopy(hp->h_addr, &addr.sin_addr, hp->h_length);
else {
*errstr = "cannot translate hostname to an address";
return -1;
}
if(bind(fd, (struct sockaddr *) &addr, sizeof(struct sockaddr_in)) < 0) {
*errstr = "cannot bind socket";
close(fd);