[libglnx] glnx-local-alloc: Make check for invalid FDs more general



commit 2576a07e6e5a400501b126e0c73b042519bb5001
Author: Philip Withnall <withnall endlessm com>
Date:   Thu Apr 20 16:58:52 2017 +0100

    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>

 glnx-local-alloc.h |    4 ++--
 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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]