From 5db0a412ff6972e51ccddaf1e8d6a27c8de4990f Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Sun, 28 Nov 2010 23:11:14 +0100 Subject: atoi: remove atoi usage --- tests/server/rtspd.c | 4 ++-- tests/server/sws.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/server') diff --git a/tests/server/rtspd.c b/tests/server/rtspd.c index d2471b998..f751f1153 100644 --- a/tests/server/rtspd.c +++ b/tests/server/rtspd.c @@ -531,8 +531,8 @@ static int ProcessRequest(struct httprequest *req) /* if the host name starts with test, the port number used in the CONNECT line will be used as test number! */ char *portp = strchr(doc, ':'); - if(portp) - req->testno = atoi(portp+1); + if(portp && (*(portp+1) != '\0') && ISDIGIT(*(portp+1))) + req->testno = strtol(portp+1, NULL, 10); else req->testno = DOCNUMBER_CONNECT; } diff --git a/tests/server/sws.c b/tests/server/sws.c index 1650226e6..65a61c2ce 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -467,8 +467,8 @@ static int ProcessRequest(struct httprequest *req) /* if the host name starts with test, the port number used in the CONNECT line will be used as test number! */ char *portp = strchr(doc, ':'); - if(portp) - req->testno = atoi(portp+1); + if(portp && (*(portp+1) != '\0') && ISDIGIT(*(portp+1))) + req->testno = strtol(portp+1, NULL, 10); else req->testno = DOCNUMBER_CONNECT; } -- cgit v1.2.3