[gnome-builder] counters: clean up fd checks when opening shm zone



commit 9b848d8b9ad7f875acc7fc0075dd643c0bfaf30c
Author: Christian Hergert <christian hergert me>
Date:   Sat Oct 3 16:48:35 2015 -0700

    counters: clean up fd checks when opening shm zone

 contrib/egg/egg-counter.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/contrib/egg/egg-counter.c b/contrib/egg/egg-counter.c
index 634641c..2f8e403 100644
--- a/contrib/egg/egg-counter.c
+++ b/contrib/egg/egg-counter.c
@@ -276,7 +276,8 @@ _egg_counter_arena_init_remote (EggCounterArena *arena,
 
   g_snprintf (name, sizeof name, NAME_FORMAT, (int)pid);
 
-  if (-1 == (fd = shm_open (name, O_RDONLY, 0)))
+  fd = shm_open (name, O_RDONLY, 0);
+  if (fd < 0)
     return FALSE;
 
   count = pread (fd, &header, sizeof header, 0);
@@ -346,8 +347,7 @@ _egg_counter_arena_init_remote (EggCounterArena *arena,
   return TRUE;
 
 failure:
-  if (fd != -1)
-    close (fd);
+  close (fd);
 
   if ((mem != NULL) && (mem != MAP_FAILED))
     munmap (mem, header.size);


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