diff options
author | Thomas Haller <thaller@redhat.com> | 2017-10-19 15:21:45 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2017-10-19 15:49:58 +0200 |
commit | 956b3e8bd580da03473fb6930cede23f4e188640 (patch) | |
tree | 6fd6b8eac0d6a2a9ef74440d9ca7d65cf87ada21 | |
parent | d29115c138dcd88172eb2668cf0a40b5bc428716 (diff) | |
download | NetworkManager-956b3e8bd580da03473fb6930cede23f4e188640.tar.gz |
shared: add nm_steal_fd() helper function
-rw-r--r-- | shared/nm-utils/nm-macros-internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h index a8f78e6d2d..5376e615ec 100644 --- a/shared/nm-utils/nm-macros-internal.h +++ b/shared/nm-utils/nm-macros-internal.h @@ -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: * |