summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank K├╝hndel <frank.kuehndel@embedded-brains.de>2022-09-16 19:07:18 +0200
committerJoel Sherrill <joel@rtems.org>2022-12-02 09:32:01 -0600
commit997ba1d905d91d62f23fee1fe43c7faa2c44a44b (patch)
tree80fb8c20b537ab0ef837659f4c6dc6a1acd1becb
parentconfig: Add CONFIGURE_RECORD_INTERRUPTS_ENABLED (diff)
downloadrtems-master.tar.bz2
tftpDriver.c: Fix Coverity issuesHEADmaster
CID 1506523: Unchecked return value from library (CHECKED_RETURN) CID 1506522: Unchecked return value from library (CHECKED_RETURN) CID 1437618: Unchecked return value from library (CHECKED_RETURN) Close #4718
Diffstat (limited to '')
-rw-r--r--cpukit/libfs/src/ftpfs/tftpDriver.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/cpukit/libfs/src/ftpfs/tftpDriver.c b/cpukit/libfs/src/ftpfs/tftpDriver.c
index 59136ef59f..0246ed9611 100644
--- a/cpukit/libfs/src/ftpfs/tftpDriver.c
+++ b/cpukit/libfs/src/ftpfs/tftpDriver.c
@@ -525,8 +525,10 @@ static void send_error (
/*
* Send it
+ *
+ * Ignoring result because error packets are sent once and maybe lost.
*/
- sendto (tp->socket, (char *)&msg, len, 0, (struct sockaddr *)to, sizeof *to);
+ (void) sendto (tp->socket, (char *)&msg, len, 0, (struct sockaddr *)to, sizeof *to);
}
/*
@@ -552,11 +554,21 @@ getPacket (struct tftpStream *tp, int retryCount)
} else if (retryCount == 0) {
tv.tv_sec = tp->config.first_timeout / 1000L;
tv.tv_usec = (tp->config.first_timeout % 1000L) * 1000L;
- setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
+ /*
+ * Ignoring result because all possible errors indicate wrong
+ * arguments and these arguments are OK as tested by test suite.
+ */
+ (void) setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv,
+ sizeof tv);
} else {
tv.tv_sec = tp->config.timeout / 1000L;
tv.tv_usec = (tp->config.timeout % 1000L) * 1000L;
- setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
+ /*
+ * Ignoring result because all possible errors indicate wrong
+ * arguments and these arguments are OK as tested by test suite.
+ */
+ (void) setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv,
+ sizeof tv);
}
for (;;) {
union {
@@ -591,7 +603,12 @@ getPacket (struct tftpStream *tp, int retryCount)
if (retryCount != GET_PACKET_DONT_WAIT) {
tv.tv_sec = 0;
tv.tv_usec = 0;
- setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof tv);
+ /*
+ * Ignoring result because all possible errors indicate wrong
+ * arguments and these arguments are OK as tested by test suite.
+ */
+ (void) setsockopt (tp->socket, SOL_SOCKET, SO_RCVTIMEO, &tv,
+ sizeof tv);
}
return len;
}
@@ -724,7 +741,7 @@ static int process_data_packet (struct tftpStream *tp, ssize_t len)
/*
* Send it. Errors during send will not matter for this last ACK.
*/
- sendto (
+ (void) sendto (
tp->socket,
send_buf,
plen,