summaryrefslogtreecommitdiffstats
path: root/libftp
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2003-12-21 02:34:32 +0100
committerJudd Vinet <judd@archlinux.org>2003-12-21 02:34:32 +0100
commit68e24b947ea7da1e5e4c2e48109df737e8cda4f0 (patch)
tree64c5315a204c8d6599b1116ced5014959017a433 /libftp
parentf54a888a1facfd8f086d6414260be5f1b991a66b (diff)
downloadpacman-68e24b947ea7da1e5e4c2e48109df737e8cda4f0.tar.gz
pacman-68e24b947ea7da1e5e4c2e48109df737e8cda4f0.tar.xz
Imported from pacman-2.7.1.tar.gz
Diffstat (limited to 'libftp')
-rw-r--r--libftp/ftplib.c20
1 files changed, 12 insertions, 8 deletions
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)
{