summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-04-20 16:58:52 +0100
committerPhilip Withnall <withnall@endlessm.com>2017-04-21 10:22:27 +0100
commit2576a07e6e5a400501b126e0c73b042519bb5001 (patch)
tree1e00c8ef5e4872a340e57b4c1d7975f77963527a
parent4040f55ac516ef2473884928a2b9d22efa96cca3 (diff)
downloadlibglnx-2576a07e6e5a400501b126e0c73b042519bb5001.tar.gz
glnx-local-alloc: Make check for invalid FDs more general
In general, all FDs < 0 are invalid (and should not have close() called on them), so check that. This could have caused problems if a function returned an error value < -1. Signed-off-by: Philip Withnall <withnall@endlessm.com>
-rw-r--r--glnx-local-alloc.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/glnx-local-alloc.h b/glnx-local-alloc.h
index f628b61..8c1914c 100644
--- a/glnx-local-alloc.h
+++ b/glnx-local-alloc.h
@@ -199,9 +199,9 @@ glnx_cleanup_close_fdp (int *fdp)
int fd, errsv;
g_assert (fdp);
-
+
fd = *fdp;
- if (fd != -1)
+ if (fd >= 0)
{
errsv = errno;
(void) close (fd);