[gnome-commander] Fixed problem #591206 (crash while sysconf() on FreeBSD)



commit 583bfbadbdef494c42039f7beb259a8cc0953bda
Author: Piotr Eljasiak <epiotr src gnome org>
Date:   Mon Aug 10 19:06:39 2009 +0200

    Fixed problem #591206 (crash while sysconf() on FreeBSD)

 src/owner.cc |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/src/owner.cc b/src/owner.cc
index 552cc67..4c5803d 100644
--- a/src/owner.cc
+++ b/src/owner.cc
@@ -62,7 +62,13 @@ GnomeCmdOwner::GnomeCmdOwner()
 
     if (!buff)
     {
-        buffsize = max(sysconf(_SC_GETPW_R_SIZE_MAX), sysconf(_SC_GETGR_R_SIZE_MAX));
+        long int pw_size = sysconf(_SC_GETPW_R_SIZE_MAX);
+        long int gr_size = sysconf(_SC_GETGR_R_SIZE_MAX);
+
+        if (pw_size==-1)    pw_size = 4096;     // `sysconf' does not support _SC_GETPW_R_SIZE_MAX. Try a moderate value.
+        if (gr_size==-1)    gr_size = 4096;     // `sysconf' does not support _SC_GETGR_R_SIZE_MAX. Try a moderate value.
+
+        buffsize = max(pw_size, gr_size);
         buff = g_new0 (char, buffsize);
     }
 



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