[libglnx] localalloc: Abort on EBADF from close() by default
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx] localalloc: Abort on EBADF from close() by default
- Date: Thu, 27 Jul 2017 10:19:07 +0000 (UTC)
commit 50a0feaba03ffa5a1980d3a14487276b8f49f8a6
Author: Colin Walters <walters verbum org>
Date: Wed Jul 26 16:03:27 2017 -0400
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.
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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]