]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
cleanups for coverity complaints about unused code
authorAlan T. DeKok <aland@freeradius.org>
Tue, 14 May 2024 21:15:06 +0000 (17:15 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 14 May 2024 21:15:06 +0000 (17:15 -0400)
src/lib/bio/fd.c

index 457a2f059f9c5e9cc10e2750dbb1198d9ba410b6..be6b166257bc303d96cd3414134527e9ed7c3be8 100644 (file)
@@ -147,6 +147,7 @@ static ssize_t fr_bio_fd_read_connected_datagram(fr_bio_t *bio, UNUSED void *pac
 
 retry:
        rcode = read(my->info.socket.fd, buffer, size);
+       if (rcode == 0) return rcode;
 
 #include "fd_read.h"
 
@@ -179,6 +180,8 @@ retry:
                                               &sockaddr, salen);
        }
 
+       if (rcode == 0) return rcode;
+
 #include "fd_read.h"
 
        return fr_bio_error(IO);
@@ -289,6 +292,8 @@ retry:
                                               &from, my->msgh.msg_namelen);
        }
 
+       if (rcode == 0) return rcode;
+
 #include "fd_read.h"
 
        return fr_bio_error(IO);
@@ -429,7 +434,6 @@ static ssize_t fr_bio_fd_sendfromto4(fr_bio_t *bio, void *packet_ctx, const void
 
 retry:
        rcode = sendmsg(my->info.socket.fd, &my->msgh, 0);
-       if (rcode >= 0) return rcode;
 
 #include "fd_write.h"
 
@@ -1137,9 +1141,11 @@ static ssize_t fr_bio_fd_read_discard(fr_bio_t *bio, UNUSED void *packet_ctx, vo
 
 retry:
        rcode = read(my->info.socket.fd, buffer, size);
-       if (rcode > 0) rcode = 0; /* always return that we read no data */
+       if (rcode >= 0) return 0; /* always return that we read no data */
 
-#include "fd_read.h"
+#undef flag_blocked
+#define flag_blocked read_blocked
+#include "fd_errno.h"
 
        return fr_bio_error(IO);
 }