[monitoring-plugins] plugins/check_ntp_time.c: add missing sockaddr_un ...

GitHub git at monitoring-plugins.org
Mon Jul 6 12:20:13 CEST 2026


    Module: monitoring-plugins
    Branch: master
    Commit: ab70d6297932b8215cd2230afd85b6e444b29521
    Author: Michael Orlitzky <michael at orlitzky.com>
 Committer: GitHub <noreply at github.com>
      Date: Mon Jul  6 06:14:53 2026 -0400
       URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=ab70d629

plugins/check_ntp_time.c: add missing sockaddr_un -> sockaddr cast (#2297)

Newer GCC with -Werror=incompatible-pointer-types enabled by default
will choke on this:

  check_ntp_time.c: In function 'offset_request':
  check_ntp_time.c:404:42: error: passing argument 2 of 'connect' from
  incompatible pointer type [-Wincompatible-pointer-types]
  404 | if (connect(socklist[0], &unix_socket, sizeof(unix_socket))) {
      |                          ^~~~~~~~~~~~
      |                          |
      |                          struct sockaddr_un *

---

 plugins/check_ntp_time.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c
index 2d9a6f40..5ad615c2 100644
--- a/plugins/check_ntp_time.c
+++ b/plugins/check_ntp_time.c
@@ -401,7 +401,7 @@ static offset_request_wrapper offset_request(const char *host, const char *port,
 		}
 		strncpy(unix_socket.sun_path, host, sizeof(unix_socket.sun_path));
 
-		if (connect(socklist[0], &unix_socket, sizeof(unix_socket))) {
+		if (connect(socklist[0], (struct sockaddr *)&unix_socket, sizeof(unix_socket))) {
 			/* don't die here, because it is enough if there is one server
 			   answering in time. This also would break for dual ipv4/6 stacked
 			   ntp servers when the client only supports on of them.



More information about the Commits mailing list