[gnome-builder/gnome-builder-3-18] counters: check result of sysconf(_SC_PAGE_SIZE)



commit 6d06070fa256989f31a5d881bbdea2961a289e22
Author: Christian Hergert <christian hergert me>
Date:   Sat Oct 3 16:03:10 2015 -0700

    counters: check result of sysconf(_SC_PAGE_SIZE)
    
    Unlikely, but sure.

 contrib/egg/egg-counter.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/contrib/egg/egg-counter.c b/contrib/egg/egg-counter.c
index 2c3da29..634641c 100644
--- a/contrib/egg/egg-counter.c
+++ b/contrib/egg/egg-counter.c
@@ -160,13 +160,20 @@ _egg_counter_arena_init_local (EggCounterArena *arena)
   ShmHeader *header;
   gpointer mem;
   unsigned pid;
-  gsize page_size;
   gsize size;
+  gint page_size;
   gint fd;
   gchar name [32];
 
   page_size = sysconf (_SC_PAGE_SIZE);
 
+  /* Implausible, but squashes warnings. */
+  if (page_size < 4096)
+    {
+      size = 4096 * 4;
+      goto use_malloc;
+    }
+
   /*
    * FIXME: https://bugzilla.gnome.org/show_bug.cgi?id=749280
    *


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