diff options
Diffstat (limited to 'apps/netutils/ftpc/ftpc_getfile.c')
-rw-r--r-- | apps/netutils/ftpc/ftpc_getfile.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/netutils/ftpc/ftpc_getfile.c b/apps/netutils/ftpc/ftpc_getfile.c index bf9fc69ea..9df827c6e 100644 --- a/apps/netutils/ftpc/ftpc_getfile.c +++ b/apps/netutils/ftpc/ftpc_getfile.c @@ -151,7 +151,7 @@ static int ftpc_recvinit(struct ftpc_session_s *session, FAR const char *path, /* Accept a connection on the data socket */ - ret = ftpc_sockaccept(&session->data, "r", FTPC_IS_PASSIVE(session)); + ret = ftpc_sockaccept(&session->data, FTPC_IS_PASSIVE(session)); if (ret != OK) { ndbg("data connection not accepted\n"); @@ -274,6 +274,19 @@ int ftpc_getfile(SESSION handle, FAR const char *rname, FAR const char *lname, off_t offset; int ret; + /* Don't call this with a NULL remote file name */ + + DEBUGASSERT(rname); + + /* If the local name is not specified, then it is assumed to the same as + * the remote file name. + */ + + if (!lname) + { + lname = rname; + } + /* Get the full path to the local file */ abslpath = ftpc_abslpath(session, lname); |