diff options
author | Colin Walters <walters@verbum.org> | 2017-07-26 16:03:27 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2017-07-26 16:13:06 -0400 |
commit | 50a0feaba03ffa5a1980d3a14487276b8f49f8a6 (patch) | |
tree | 06b5aafec9f321f21a2c25272a2cd1bff1022538 | |
parent | ea6df95f22c8f2973714bdbb8b1accc4e37d4d56 (diff) | |
download | libglnx-50a0feaba03ffa5a1980d3a14487276b8f49f8a6.tar.gz |
localalloc: Abort on EBADF from close() by default
systemd does this by default. I think we should treat this as a fatal error
since it can cause really painful-to-debug problems if we don't just get
EBADF but actually close something else's fd due to a race.
-rw-r--r-- | glnx-local-alloc.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/glnx-local-alloc.h b/glnx-local-alloc.h index 8c1914c..af8d72f 100644 --- a/glnx-local-alloc.h +++ b/glnx-local-alloc.h @@ -204,7 +204,8 @@ glnx_cleanup_close_fdp (int *fdp) if (fd >= 0) { errsv = errno; - (void) close (fd); + if (close (fd) < 0) + g_assert (errno != EBADF); errno = errsv; } } |