mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-11 08:40:19 +01:00
shared: add nm_steal_fd() helper function
This commit is contained in:
parent
d29115c138
commit
956b3e8bd5
1 changed files with 13 additions and 0 deletions
|
|
@ -1151,6 +1151,19 @@ nm_decode_version (guint version, guint *major, guint *minor, guint *micro)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
static inline int
|
||||
nm_steal_fd (int *p_fd)
|
||||
{
|
||||
int fd;
|
||||
|
||||
if ( p_fd
|
||||
&& ((fd = *p_fd) > 0)) {
|
||||
*p_fd = -1;
|
||||
return fd;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_close:
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue