bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] stat: use pathmax.h only if needed


From: Paul Eggert
Subject: [PATCH] stat: use pathmax.h only if needed
Date: Sun, 18 Sep 2011 21:48:14 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.21) Gecko/20110831 Thunderbird/3.1.13

* lib/stat.c: Include pathmax.h only if REPLACE_FUNC_STAT_DIR.
This is better for Emacs, which does not have a mingw port and
therefore can avoid the pathmax module.
---
 ChangeLog  |    5 +++++
 lib/stat.c |   11 +++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 382b79c..72bd11e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-09-18  Paul Eggert  <address@hidden>
 
+       stat: use pathmax.h only if needed
+       * lib/stat.c: Include pathmax.h only if REPLACE_FUNC_STAT_DIR.
+       This is better for Emacs, which does not have a mingw port and
+       therefore can avoid the pathmax module.
+
        utimens: remove dependency on dup2
        * lib/utimens.c (fdutimens): Don't invoke dup2; it's not needed
        to work around the Linux kernel bug.
diff --git a/lib/stat.c b/lib/stat.c
index ae86929..fe5b1ac 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -44,9 +44,15 @@ orig_stat (const char *filename, struct stat *buf)
 #include <stdbool.h>
 #include <string.h>
 #include "dosname.h"
-#include "pathmax.h"
 #include "verify.h"
 
+#if REPLACE_FUNC_STAT_DIR
+# include "pathmax.h"
+# ifndef PATH_MAX
+#  error "Please port this replacement to your platform"
+# endif
+#endif
+
 /* Store information about NAME into ST.  Work around bugs with
    trailing slashes.  Mingw has other bugs (such as st_ino always
    being 0 on success) which this wrapper does not work around.  But
@@ -73,9 +79,6 @@ rpl_stat (char const *name, struct stat *st)
 #if REPLACE_FUNC_STAT_DIR
   /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
      have a constant PATH_MAX.  */
-# ifndef PATH_MAX
-#  error "Please port this replacement to your platform"
-# endif
 
   if (result == -1 && errno == ENOENT)
     {
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]