Add glnx_steal_fd

This is very useful in combination with glnx_close_fd

https://bugzilla.gnome.org/show_bug.cgi?id=757611
This commit is contained in:
Alexander Larsson
2015-12-11 15:56:06 +01:00
parent bf4d1504a4
commit 4e9969998b

View File

@@ -211,4 +211,12 @@ glnx_cleanup_close_fdp (int *fdp)
*/
#define glnx_fd_close __attribute__((cleanup(glnx_cleanup_close_fdp)))
static inline int
glnx_steal_fd (int *fdp)
{
int fd = *fdp;
*fdp = -1;
return fd;
}
G_END_DECLS