From 56fc0cc15dd9b2986e890dd8b919c9af4a8fa46a Mon Sep 17 00:00:00 2001 From: Mats Erik Andersson Date: Thu, 2 Mar 2017 16:20:47 +0100 Subject: [PATCH] ftp: Portability to Android. Add external declaration of getpass(). Tiny patch by Fredrik Fornwall . --- ChangeLog | 13 +++++++++++++ ftp/cmds.c | 6 ++++++ ftp/ftp.c | 3 +++ 3 files changed, 22 insertions(+) diff --git a/ChangeLog b/ChangeLog index 6b2a36b6..119787b0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2017-03-02 Fredrik Fornwall (tiny change) + + ftp: Portability to Android. + Without a check for HAVE_DECL_GETPASS and without making a + local function declaration, the implicit declaration causes + crashes on 64-bit systems lacking declared getpass(), such + as Android. Reported in: + http://lists.gnu.org/archive/html/bug-inetutils/2016-10/msg00000.html + + * ftp/cmds.c [!HAVE_DECL_GETPASS] (user, account): Declare getpass() + as external function. + * ftp/ftp.c (login): Likewise. + 2017-03-02 Mats Erik Andersson whois: Update Canadian TLD server. diff --git a/ftp/cmds.c b/ftp/cmds.c index 233658bd..c90180eb 100644 --- a/ftp/cmds.c +++ b/ftp/cmds.c @@ -1721,6 +1721,9 @@ shell (int argc, char **argv _GL_UNUSED_PARAMETER) void user (int argc, char **argv) { +#if !HAVE_DECL_GETPASS + extern char *getpass (); +#endif char acct[80]; int n, aflag = 0; @@ -2070,6 +2073,9 @@ globulize (char *cp) void account (int argc, char **argv) { +#if !HAVE_DECL_GETPASS + extern char *getpass (); +#endif char acct[50], *ap; if (argc > 1) diff --git a/ftp/ftp.c b/ftp/ftp.c index a9d96bf5..5eff2d74 100644 --- a/ftp/ftp.c +++ b/ftp/ftp.c @@ -296,6 +296,9 @@ bad: int login (char *host) { +#if !HAVE_DECL_GETPASS + extern char *getpass (); +#endif char tmp[80]; char *user, *pass, *acct, *p; int n, aflag = 0;