mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-04 01:20:36 +01:00
dhcp: assert that pid_t is signed for NMDhcpClient
Probably pid_t is always signed, because kill() documents that
negative values have a special meaning (technically, C would
automatically cast negative signed values to an unsigned pid_t type
too).
Anyway, NMDhcpClient at several places uses -1 as special value for "no
pid". At the same time, it checks for valid PIDs with "pid > 1". That
only works if pid_t is signed.
Add a static assertion for that.
(cherry picked from commit 92bfe09724)
This commit is contained in:
parent
8444188c49
commit
7751177474
1 changed files with 5 additions and 0 deletions
|
|
@ -84,6 +84,11 @@ G_DEFINE_ABSTRACT_TYPE(NMDhcpClient, nm_dhcp_client, G_TYPE_OBJECT)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/* we use pid=-1 for invalid PIDs. Ensure that pid_t can hold negative values. */
|
||||
G_STATIC_ASSERT(!(((pid_t) -1) > 0));
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
pid_t
|
||||
nm_dhcp_client_get_pid(NMDhcpClient *self)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue