Correct and error in recv() and recvfrom() return value

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4402 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-02-18 18:13:30 +00:00
parent f60d578a46
commit f04310d559
24 changed files with 189 additions and 128 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ int tftpget(const char *remote, const char *local, in_addr_t addr, bool binary)
/* Check if anything valid was received */
if (nbytesrecvd >= 0)
if (nbytesrecvd > 0)
{
/* Verify the sender address and port number */
+2 -2
View File
@@ -1,8 +1,8 @@
/****************************************************************************
* netuils/tftp/tftpc_packets.c
*
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
* Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
+10 -2
View File
@@ -217,9 +217,17 @@ static int tftp_rcvack(int sd, uint8_t *packet, struct sockaddr_in *server,
{
/* Failed to receive a good packet */
if (nbytes >= 0)
if (nbytes == 0)
{
ndbg("tftp_recvfrom short packet: %d bytes\n", nbytes);
ndbg("Connection lost: %d bytes\n", nbytes);
}
else if (nbytes > 0)
{
ndbg("Short packet: %d bytes\n", nbytes);
}
else
{
ndbg("Recveid failure\n");
}
/* Break out to bump up the retry count */