Bug 412610 - "MAXPATHLEN too small for glibc's realpath()" (define MAXPATHLEN as PATH_MAX when PATH_MAX is available) [r=bsmedberg]
authorDmitry Potapov <dpotapov@gmail.com>
Mon, 20 Oct 2008 22:55:57 -0500
changeset 20704 adf33dbb59d04461121d236451dc8b5973b96fab
parent 20703 6e9a29a235ce506b4ca35fabefa34b48033beb69
child 20705 c53251d62ddf3b05e6c27346d4a49014e368022c
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-esr52@a95d42642281 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs412610
milestone1.9.1b2pre
Bug 412610 - "MAXPATHLEN too small for glibc's realpath()" (define MAXPATHLEN as PATH_MAX when PATH_MAX is available) [r=bsmedberg]
browser/components/migration/src/nsDogbertProfileMigrator.cpp
browser/components/migration/src/nsProfileMigrator.cpp
toolkit/mozapps/update/src/updater/updater.cpp
toolkit/xre/nsAppRunner.h
xpcom/build/nsXPCOMPrivate.h
--- a/browser/components/migration/src/nsDogbertProfileMigrator.cpp
+++ b/browser/components/migration/src/nsDogbertProfileMigrator.cpp
@@ -53,19 +53,22 @@
 #include "nsNetCID.h"
 #include "nsNetUtil.h"
 #include "prprf.h"
 #include "prenv.h"
 #include "NSReg.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsDirectoryServiceUtils.h"
 #include <stdlib.h>
+#include <limits.h>
 
 #ifndef MAXPATHLEN
-#ifdef _MAX_PATH
+#ifdef PATH_MAX
+#define MAXPATHLEN PATH_MAX
+#elif defined(_MAX_PATH)
 #define MAXPATHLEN _MAX_PATH
 #elif defined(CCHMAXPATH)
 #define MAXPATHLEN CCHMAXPATH
 #else
 #define MAXPATHLEN 1024
 #endif
 #endif
 
--- a/browser/components/migration/src/nsProfileMigrator.cpp
+++ b/browser/components/migration/src/nsProfileMigrator.cpp
@@ -58,22 +58,26 @@
 
 #include "NSReg.h"
 #include "nsStringAPI.h"
 #include "nsUnicharUtils.h"
 #ifdef XP_WIN
 #include <windows.h>
 #include "nsIWindowsRegKey.h"
 #include "nsILocalFileWin.h"
+#else
+#include <limits.h>
 #endif
 
 #include "nsAutoPtr.h"
 
 #ifndef MAXPATHLEN
-#ifdef _MAX_PATH
+#ifdef PATH_MAX
+#define MAXPATHLEN PATH_MAX
+#elif defined(_MAX_PATH)
 #define MAXPATHLEN _MAX_PATH
 #elif defined(CCHMAXPATH)
 #define MAXPATHLEN CCHMAXPATH
 #else
 #define MAXPATHLEN 1024
 #endif
 #endif
 
--- a/toolkit/mozapps/update/src/updater/updater.cpp
+++ b/toolkit/mozapps/update/src/updater/updater.cpp
@@ -113,17 +113,19 @@ void LaunchChild(int argc, char **argv);
 # define NULL (0)
 #endif
 
 #ifndef SSIZE_MAX
 # define SSIZE_MAX LONG_MAX
 #endif
 
 #ifndef MAXPATHLEN
-# ifdef MAX_PATH
+# ifdef PATH_MAX
+#  define MAXPATHLEN PATH_MAX
+# elif defined(_MAX_PATH)
 #  define MAXPATHLEN MAX_PATH
 # elif defined(_MAX_PATH)
 #  define MAXPATHLEN _MAX_PATH
 # elif defined(CCHMAXPATH)
 #  define MAXPATHLEN CCHMAXPATH
 # else
 #  define MAXPATHLEN 1024
 # endif
--- a/toolkit/xre/nsAppRunner.h
+++ b/toolkit/xre/nsAppRunner.h
@@ -35,20 +35,24 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsAppRunner_h__
 #define nsAppRunner_h__
 
 #ifdef XP_WIN
 #include <windows.h>
+#else
+#include <limits.h>
 #endif
 
 #ifndef MAXPATHLEN
-#ifdef _MAX_PATH
+#ifdef PATH_MAX
+#define MAXPATHLEN PATH_MAX
+#elif defined(_MAX_PATH)
 #define MAXPATHLEN _MAX_PATH
 #elif defined(CCHMAXPATH)
 #define MAXPATHLEN CCHMAXPATH
 #else
 #define MAXPATHLEN 1024
 #endif
 #endif
 
--- a/xpcom/build/nsXPCOMPrivate.h
+++ b/xpcom/build/nsXPCOMPrivate.h
@@ -226,16 +226,17 @@ NS_GetFrozenFunctions(XPCOMFunctions *en
 #define XPCOM_SEARCH_KEY  "ADDON_PATH"
 #define GRE_CONF_NAME "gre.config"
 #define GRE_CONF_PATH "gre.conf"
 #define GRE_CONF_DIR  "gre.d"
 #define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
 #define XUL_DLL   "libxul"MOZ_DLL_SUFFIX
 
 #else // Unix
+#include <limits.h> // for PATH_MAX
 
 #define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
 
 // you have to love apple..
 #ifdef XP_MACOSX  
 #define XPCOM_SEARCH_KEY  "DYLD_LIBRARY_PATH"
 #define GRE_FRAMEWORK_NAME "XUL.framework"
 #define XUL_DLL            "XUL"