]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
{pidfd,cgroup}-util: avoid alignment warning when accessing f_handle (#37520)
authorLuca Boccassi <bluca@debian.org>
Tue, 20 May 2025 13:50:22 +0000 (14:50 +0100)
committerGitHub <noreply@github.com>
Tue, 20 May 2025 13:50:22 +0000 (14:50 +0100)
NetworkManager imports some systemd code, which we then build with
`-Wcast-align=strict`. This results in this warning:

```
../src/libnm-systemd-shared/src/basic/pidfd-util.c: In function 'pidfd_get_inode_id':
../src/libnm-systemd-shared/src/basic/pidfd-util.c:255:41: warning: cast increases required alignment of target type [-Wcast-align]
  255 |                                 *ret = *(uint64_t*) fh.file_handle.f_handle;
      |                                         ^
```

Since the address of `f_handle` should always be aligned at the word
boundary (it is preceded by 2 int`s` in `file_handle`), this patch uses
`CAST_ALIGN_PTR()` to avoid this warning.


Trivial merge