(ftpfs_netrc_lookup): fix null check after dereference

...and simplify.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2014-04-20 19:05:00 +04:00
parent e33a48fc95
commit 24c14153c5

View File

@ -2429,11 +2429,9 @@ ftpfs_netrc_lookup (const char *host, char **login, char **pass)
/* Look up in the cache first */ /* Look up in the cache first */
for (rupp = rup_cache; rupp != NULL; rupp = rupp->next) for (rupp = rup_cache; rupp != NULL; rupp = rupp->next)
{ {
if (!strcmp (host, rupp->host)) if (strcmp (host, rupp->host) == 0)
{ {
if (rupp->login)
*login = g_strdup (rupp->login); *login = g_strdup (rupp->login);
if (pass && rupp->pass)
*pass = g_strdup (rupp->pass); *pass = g_strdup (rupp->pass);
return 0; return 0;
} }