From b2320af622e1343ca986c9a4dd92b555da22cfcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Love=20H=C3=B6rnquist=20=C3=85strand?= Date: Thu, 7 Apr 2005 18:57:29 +0000 Subject: [PATCH] fix 3 'var' might be used uninitialized warnings git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14750 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/ftp/ftp.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/appl/ftp/ftp/ftp.c b/appl/ftp/ftp/ftp.c index 12f328597..daa620b52 100644 --- a/appl/ftp/ftp/ftp.c +++ b/appl/ftp/ftp/ftp.c @@ -79,6 +79,7 @@ hookup (const char *host, int port) strlcpy (hostnamebuf, host, sizeof(hostnamebuf)); hostname = hostnamebuf; + s = -1; for (a = ai; a != NULL; a = a->ai_next) { s = socket (a->ai_family, a->ai_socktype, a->ai_protocol); if (s < 0) @@ -100,12 +101,13 @@ hookup (const char *host, int port) warn ("connect %s", addrstr); close (s); + s = -1; continue; } break; } freeaddrinfo (ai); - if (error < 0) { + if (s < 0) { warnx ("failed to contact %s", host); code = -1; return NULL; @@ -727,6 +729,8 @@ sendrequest (char *cmd, char *local, char *remote, char *lmode, int printnames) case TYPE_L: rc = lseek (fileno (fin), restart_point, SEEK_SET); break; + default: + abort(); } if (rc < 0) { warn ("local: %s", local); @@ -859,7 +863,7 @@ void recvrequest (char *cmd, char *local, char *remote, char *lmode, int printnames, int local_given) { - FILE *fout, *din = 0; + FILE *fout = NULL, *din = NULL; int (*closefunc) (FILE *); sighand oldintr, oldintp; int c, d, is_retr, tcrflag, bare_lfs = 0; @@ -1544,7 +1548,7 @@ abortpt (int sig) void proxtrans (char *cmd, char *local, char *remote) { - sighand oldintr; + sighand oldintr = NULL; int secndflag = 0, prox_type, nfnd; char *cmd2; fd_set mask; @@ -1616,7 +1620,8 @@ abort: pswitch (1); if (ptabflg) code = -1; - signal (SIGINT, oldintr); + if (oldintr) + signal (SIGINT, oldintr); return; } if (cpend)