summaryrefslogtreecommitdiffstats
path: root/mbbsd/talk.c
diff options
context:
space:
mode:
authorkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-09-17 02:45:02 +0800
committerkcwu <kcwu@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-09-17 02:45:02 +0800
commit83d93227d399ba3c9a4452914fefb2d657e9218d (patch)
tree54014ffdc1ab808327f0d1a216fab0132a7bf266 /mbbsd/talk.c
parent4429dbffee0301ff16cc3a59419c61c2995b7594 (diff)
downloadpttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.tar
pttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.tar.gz
pttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.tar.bz2
pttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.tar.lz
pttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.tar.xz
pttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.tar.zst
pttbbs-83d93227d399ba3c9a4452914fefb2d657e9218d.zip
avoid to use gethostbyname() which require hidden memory consumption.
save near 1k memory. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3417 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/talk.c')
-rw-r--r--mbbsd/talk.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/mbbsd/talk.c b/mbbsd/talk.c
index 11b1abfb..408c9ac8 100644
--- a/mbbsd/talk.c
+++ b/mbbsd/talk.c
@@ -3107,19 +3107,14 @@ int
establish_talk_connection(const userinfo_t *uip)
{
int a;
- struct hostent *h;
struct sockaddr_in sin;
currutmp->msgcount = 0;
strlcpy(save_page_requestor, page_requestor, sizeof(save_page_requestor));
memset(page_requestor, 0, sizeof(page_requestor));
- if (!(h = gethostbyname("localhost"))) {
- perror("gethostbyname");
- return -1;
- }
memset(&sin, 0, sizeof(sin));
- sin.sin_family = h->h_addrtype;
- memcpy(&sin.sin_addr, h->h_addr, h->h_length);
+ sin.sin_family = PF_INET;
+ sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
sin.sin_port = uip->sockaddr;
if ((a = socket(sin.sin_family, SOCK_STREAM, 0)) < 0) {
perror("connect err");