]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
sunrpc: Fix clang build
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>
Mon, 20 Oct 2025 12:27:54 +0000 (09:27 -0300)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 21 Oct 2025 12:27:05 +0000 (09:27 -0300)
clang-21 issues:

rtime.c:96:36: error: variable 'thetime' is uninitialized when passed as a const pointer argument here
      [-Werror,-Wuninitialized-const-pointer]
   96 |       res = __sendto (s, (char *) &thetime, sizeof (thetime), 0,
      |                                    ^~~~~~~

For SOCK_DGRAM the sendto sends an uninitialized value.

Reviewed-by: Collin Funk <collin.funk1@gmail.com>
sunrpc/rtime.c

index e3cffe26d488155d51e49c549ffc140c6b850ea4..3cddb848c466037bbb9e8462732a39738d17e879 100644 (file)
@@ -75,7 +75,7 @@ rtime (struct sockaddr_in *addrp, struct rpc_timeval *timep,
   int milliseconds;
   int res;
   /* RFC 868 says the time is transmitted as a 32-bit value.  */
-  uint32_t thetime;
+  uint32_t thetime = 0;
   struct sockaddr_in from;
   socklen_t fromlen;
   int type;