Subject: crashes with Factory's glibc
From: upstream

================================================================================
--- mozilla/config/pathsub.h
+++ mozilla/config/pathsub.h
@@ -46,7 +46,7 @@
 #include <sys/types.h>
 
 #ifndef PATH_MAX
-#define PATH_MAX 1024
+#error  "PATH_MAX is not defined!"
 #endif
 
 /*
--- mozilla/dbm/include/mcom_db.h
+++ mozilla/dbm/include/mcom_db.h
@@ -214,7 +214,8 @@
 #endif  /* __DBINTERFACE_PRIVATE */
 
 #ifdef SCO
-#define MAXPATHLEN 	1024              
+#include <limits.h>
+#define MAXPATHLEN 	PATH_MAX     
 #endif
 
 #include <fcntl.h>
--- mozilla/js/src/jsfile.c
+++ mozilla/js/src/jsfile.c
@@ -105,7 +105,8 @@
 #define utfstring               "binary"
 #define unicodestring           "unicode"
 
-#define MAX_PATH_LENGTH         1024
+#include <limits.h>
+#define MAX_PATH_LENGTH         PATH_MAX
 #define MODE_SIZE               256
 #define NUMBER_SIZE             32
 #define MAX_LINE_LENGTH         256
--- mozilla/modules/libjar/nsZipArchive.cpp
+++ mozilla/modules/libjar/nsZipArchive.cpp
@@ -121,7 +121,7 @@
 #    define S_IFLNK  0120000
 #  endif
 #  ifndef PATH_MAX
-#    define PATH_MAX 1024
+#    include <limits.h>
 #  endif
 #endif  /* XP_UNIX */
 
--- mozilla/modules/libreg/src/reg.c
+++ mozilla/modules/libreg/src/reg.c
@@ -96,7 +96,8 @@
 #define MAX_PATH PATH_MAX
 #elif defined(XP_UNIX)
 #ifndef MAX_PATH
-#define MAX_PATH 1024
+#include <limits.h>
+#define MAX_PATH PATH_MAX
 #endif
 #elif defined(XP_OS2)
 #ifndef MAX_PATH
--- mozilla/nsprpub/config/pathsub.h
+++ mozilla/nsprpub/config/pathsub.h
@@ -50,7 +50,7 @@
 #endif
 
 #ifndef PATH_MAX
-#define PATH_MAX 1024
+#error  "PATH_MAX is not defined!"
 #endif
 
 /*
--- mozilla/security/coreconf/nsinstall/pathsub.h
+++ mozilla/security/coreconf/nsinstall/pathsub.h
@@ -49,7 +49,7 @@
 #endif
 
 #ifndef PATH_MAX
-#define PATH_MAX 1024
+#error  "PATH_MAX is not defined!"
 #endif
 
 /*
--- mozilla/toolkit/mozapps/update/src/updater/updater.cpp
+++ mozilla/toolkit/mozapps/update/src/updater/updater.cpp
@@ -107,7 +107,8 @@
 # elif defined(CCHMAXPATH)
 #  define MAXPATHLEN CCHMAXPATH
 # else
-#  define MAXPATHLEN 1024
+#  include <limits.h>
+#  define MAXPATHLEN PATH_MAX
 # endif
 #endif
 
--- mozilla/toolkit/xre/nsAppRunner.h
+++ mozilla/toolkit/xre/nsAppRunner.h
@@ -42,7 +42,8 @@
 #include <windows.h>
 #endif
 
-#define MAXPATHLEN 4096
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
 
 #include "nscore.h"
 
--- mozilla/widget/src/xremoteclient/XRemoteClient.cpp
+++ mozilla/widget/src/xremoteclient/XRemoteClient.cpp
@@ -76,7 +76,8 @@
 #endif
     
 #ifndef MAX_PATH
-#define MAX_PATH 1024
+#include <limits.h>
+#define MAX_PATH PATH_MAX
 #endif
 
 #define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0]))
--- mozilla/xpcom/build/nsXPCOMPrivate.h
+++ mozilla/xpcom/build/nsXPCOMPrivate.h
@@ -252,7 +252,8 @@
 #elif defined(CCHMAXPATH)
 #define MAXPATHLEN CCHMAXPATH
 #else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
 #endif
 #endif
 
--- mozilla/xpcom/io/SpecialSystemDirectory.cpp
+++ mozilla/xpcom/io/SpecialSystemDirectory.cpp
@@ -109,7 +109,8 @@
 #elif defined(CCHMAXPATH)
 #define MAXPATHLEN CCHMAXPATH
 #else
-#define MAXPATHLEN 1024
+#include <limits.h>
+#define MAXPATHLEN PATH_MAX
 #endif
 #endif
 
--- mozilla/xpcom/obsolete/nsFileSpecUnix.cpp
+++ mozilla/xpcom/obsolete/nsFileSpecUnix.cpp
@@ -79,7 +79,8 @@
 #endif
 
 #ifndef MAXPATHLEN
-#define MAXPATHLEN	1024  /* Guessing this is okay.  Works for SCO. */
+#include <limits.h>
+#define MAXPATHLEN	PATH_MAX  /* Guessing this is okay.  Works for SCO. */
 #endif
  
 #if defined(__QNX__)
--- mozilla/xpcom/typelib/xpidl/xpidl_java.c
+++ mozilla/xpcom/typelib/xpidl/xpidl_java.c
@@ -44,6 +44,7 @@
 #include "xpidl.h"
 #include <ctype.h>
 #include <glib.h>
+#include <limits.h>
 
 #ifdef XP_WIN
 #include <windef.h>