From 33a38e34d35d880a552a250927dc7430e31f8816 Mon Sep 17 00:00:00 2001 From: Benny Prijono Date: Thu, 1 Mar 2007 18:56:02 +0000 Subject: Related to ticket #149: added test in pjlib-test to capture host resolution crash git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1029 74dad513-b988-da41-8d7b-12977e46ad98 --- pjlib/src/pjlib-test/sock.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'pjlib') diff --git a/pjlib/src/pjlib-test/sock.c b/pjlib/src/pjlib-test/sock.c index 2eee2c5e..a3df9b63 100644 --- a/pjlib/src/pjlib-test/sock.c +++ b/pjlib/src/pjlib-test/sock.c @@ -51,6 +51,7 @@ * - pj_sock_connect() * - pj_sock_listen() * - pj_sock_accept() + * - pj_gethostbyname() * * * This file is pjlib-test/sock.c @@ -441,6 +442,23 @@ static int ioctl_test(void) return 0; } +static int gethostbyname_test(void) +{ + pj_str_t host; + pj_hostent he; + pj_status_t status; + + /* Testing pj_gethostbyname() with invalid host */ + host = pj_str("an-invalid-host-name"); + status = pj_gethostbyname(&host, &he); + + /* Must return failure! */ + if (status == PJ_SUCCESS) + return -20100; + else + return 0; +} + int sock_test() { int rc; @@ -451,6 +469,10 @@ int sock_test() if (rc != 0) return rc; + rc = gethostbyname_test(); + if (rc != 0) + return rc; + rc = simple_sock_test(); if (rc != 0) return rc; -- cgit v1.2.3