diff options
Diffstat (limited to 'glnx-local-alloc.h')
-rw-r--r-- | glnx-local-alloc.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/glnx-local-alloc.h b/glnx-local-alloc.h index af5af4b..f628b61 100644 --- a/glnx-local-alloc.h +++ b/glnx-local-alloc.h @@ -21,6 +21,7 @@ #pragma once #include <gio/gio.h> +#include <errno.h> G_BEGIN_DECLS @@ -195,13 +196,17 @@ GLNX_DEFINE_CLEANUP_FUNCTION0(GKeyFile*, glnx_local_keyfile_unref, g_key_file_un static inline void glnx_cleanup_close_fdp (int *fdp) { - int fd; + int fd, errsv; g_assert (fdp); fd = *fdp; if (fd != -1) - (void) close (fd); + { + errsv = errno; + (void) close (fd); + errno = errsv; + } } /** |