diff options
author | Hiroki Sato <hrs@FreeBSD.org> | 2008-11-01 16:45:39 +0000 |
---|---|---|
committer | Hiroki Sato <hrs@FreeBSD.org> | 2008-11-01 16:45:39 +0000 |
commit | b17d51b0d4bbe31b0b9fff35e22b320e987aadcd (patch) | |
tree | 7a58d1c26b160b006137f76ae1c31696b82811e3 /japanese/kinput2/files/patch-lib-imlib-imxport.c | |
parent | Remove obsolete patch. (diff) |
Use 127.0.0.1 for incoming communication socket (internally-used
one) instead of INADDR_ANY. This is not a user-visible change of the
original functionality.
Notes
Notes:
svn path=/head/; revision=222278
Diffstat (limited to 'japanese/kinput2/files/patch-lib-imlib-imxport.c')
-rw-r--r-- | japanese/kinput2/files/patch-lib-imlib-imxport.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/japanese/kinput2/files/patch-lib-imlib-imxport.c b/japanese/kinput2/files/patch-lib-imlib-imxport.c new file mode 100644 index 000000000000..68eeb8685ed0 --- /dev/null +++ b/japanese/kinput2/files/patch-lib-imlib-imxport.c @@ -0,0 +1,45 @@ +--- lib/imlib/imxport.c.orig 2002-10-03 18:35:31.000000000 +0900 ++++ lib/imlib/imxport.c 2008-11-02 01:23:56.000000000 +0900 +@@ -35,6 +35,7 @@ + + #ifdef IM_TCP_TRANSPORT + #include <netinet/in.h> ++#include <netdb.h> + #endif + + extern int errno; +@@ -412,8 +413,9 @@ + + #ifdef IM_TCP_TRANSPORT + int +-IMCreateTCPService(portp) ++IMCreateTCPService(portp, listenaddr) + int *portp; ++char *listenaddr; + { + struct sockaddr_in addr; + int optval = 1; +@@ -431,7 +433,22 @@ + (char *)&optval, sizeof(optval)); + #endif /* SO_REUSEADDR */ + +- bzero((char *)&addr, sizeof(addr)); ++ memset((void *)&addr, 0, sizeof(addr)); ++ if (listenaddr[0] == '\0') { ++ addr.sin_addr.s_addr = htonl(INADDR_ANY); ++ } else { ++ if (!inet_aton(listenaddr, &addr.sin_addr)) { ++ struct hostent *hp; ++ struct in_addr **pptr; ++ ++ if ((hp = gethostbyname((const char *)listenaddr)) == NULL) { ++ DPRINT(("Can't resolve %s\n", listenaddr)); ++ return -1; ++ } ++ pptr = (struct in_addr **)hp->h_addr_list; ++ memcpy((void *)&addr.sin_addr, pptr[0], sizeof(struct in_addr)); ++ } ++ } + addr.sin_family = AF_INET; + addr.sin_port = htons(*portp); + |