diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-01 23:09:29 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2011-06-01 23:09:29 +0000 |
commit | 67861ab4bc9411a36319f48f9aaad1a129fcde9b (patch) | |
tree | 97e2fb1cca991511cd55c2f7899fc6dcd612a2ab /apps/netutils/ftpc/ftpc_getfile.c | |
parent | 17b27f51ace2d8529e6bf5ac5c84d01c08d8dbf5 (diff) | |
download | nuttx-67861ab4bc9411a36319f48f9aaad1a129fcde9b.tar.gz nuttx-67861ab4bc9411a36319f48f9aaad1a129fcde9b.tar.bz2 nuttx-67861ab4bc9411a36319f48f9aaad1a129fcde9b.zip |
Add a simple shell and configuration to verify the FTP client library
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@3656 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'apps/netutils/ftpc/ftpc_getfile.c')
-rw-r--r-- | apps/netutils/ftpc/ftpc_getfile.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/apps/netutils/ftpc/ftpc_getfile.c b/apps/netutils/ftpc/ftpc_getfile.c index a3ea5008d..095bf2414 100644 --- a/apps/netutils/ftpc/ftpc_getfile.c +++ b/apps/netutils/ftpc/ftpc_getfile.c @@ -188,8 +188,8 @@ static int ftpc_recvbinary(FAR struct ftpc_session_s *session, err = ENOMEM; goto errout_with_err; } - - while (!feof(rinstream)) + + for (;;) { if (ftpc_waitinput(session) != 0) { @@ -201,8 +201,13 @@ static int ftpc_recvbinary(FAR struct ftpc_session_s *session, nread = fread(buf, sizeof(char), CONFIG_FTP_BUFSIZE, rinstream); if (nread <= 0) { - (void)ftpc_xfrabort(session, rinstream); - ret = ERROR; + /* nread == 0 means end of file */ + + if (nread < 0) + { + (void)ftpc_xfrabort(session, rinstream); + ret = ERROR; + } break; } |