]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
dbus-sysdeps-unix.c: Silence -Wcast-align when using CMSG_DATA
authorAlex Richardson <arichardson.kde@gmail.com>
Sun, 15 May 2022 10:14:02 +0000 (11:14 +0100)
committerAlexander Richardson <alexander.richardson@cl.cam.ac.uk>
Tue, 17 May 2022 11:21:33 +0000 (11:21 +0000)
This triggers when building on FreeBSD with clang, but since we know that
the CMSG_DATA() will be aligned we can silence the warning using a cast.

dbus/dbus-sysdeps-unix.c

index 9a35d07600422916d41689fc39fbdd9fde60485d..4ee232871b72e1e20779b7b4b36ea6573530a2ce 100644 (file)
@@ -461,7 +461,7 @@ _dbus_read_socket_with_unix_fds (DBusSocket        fd,
         if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_RIGHTS)
           {
             size_t i;
-            int *payload = (int *) CMSG_DATA (cm);
+            int *payload = (int *) (void *) CMSG_DATA (cm);
             size_t payload_len_bytes = (cm->cmsg_len - CMSG_LEN (0));
             size_t payload_len_fds;
             size_t fds_to_use;
@@ -2372,7 +2372,7 @@ _dbus_read_credentials_socket  (DBusSocket       client_fd,
             cmsgp->cmsg_level == SOL_SOCKET &&
             cmsgp->cmsg_len >= CMSG_LEN (sizeof (struct cmsgcred)))
           {
-            cred = (struct cmsgcred *) CMSG_DATA (cmsgp);
+            cred = (struct cmsgcred *) (void *) CMSG_DATA (cmsgp);
             pid_read = cred->cmcred_pid;
             uid_read = cred->cmcred_euid;
             break;