From 68e24b947ea7da1e5e4c2e48109df737e8cda4f0 Mon Sep 17 00:00:00 2001 From: Judd Vinet Date: Sun, 21 Dec 2003 01:34:32 +0000 Subject: Imported from pacman-2.7.1.tar.gz --- libftp/ftplib.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'libftp') diff --git a/libftp/ftplib.c b/libftp/ftplib.c index f312db89..004ede87 100644 --- a/libftp/ftplib.c +++ b/libftp/ftplib.c @@ -411,14 +411,18 @@ GLOBALDEF int FtpConnect(const char *host, netbuf **nControl) } else { - *pnum++ = '\0'; - if (isdigit(*pnum)) - sin.sin_port = htons(atoi(pnum)); - else - { - pse = getservbyname(pnum,"tcp"); - sin.sin_port = pse->s_port; - } + *pnum++ = '\0'; + if (isdigit(*pnum)) + sin.sin_port = htons(atoi(pnum)); + else + { + pse = getservbyname(pnum,"tcp"); + if(pse == NULL) { + perror("getservbyname"); + return 0; + } + sin.sin_port = pse->s_port; + } } if ((sin.sin_addr.s_addr = inet_addr(lhost)) == -1) { -- cgit v1.2.3-24-g4f1b