summaryrefslogtreecommitdiff
path: root/lib/stat.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-23 01:10:57 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-23 01:10:57 -0700
commit6dd7e40073d6f18bcb287b59256607caea17404a (patch)
tree1524f3b6e01ea057d8b03e8c5645404120d37f28 /lib/stat.c
parent7efb4e0e62ed3e11e20d15821342c322b4101ae7 (diff)
* lib/getopt.c, lib/stat.c, m4/gl-comp.m4: Merge from gnulib.
Diffstat (limited to 'lib/stat.c')
-rw-r--r--lib/stat.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/stat.c b/lib/stat.c
index cbc9100fd4..f07370dd06 100644
--- a/lib/stat.c
+++ b/lib/stat.c
@@ -38,6 +38,7 @@ orig_stat (const char *filename, struct stat *buf)
#include <stdbool.h>
#include <string.h>
#include "dosname.h"
+#include "verify.h"
/* Store information about NAME into ST. Work around bugs with
trailing slashes. Mingw has other bugs (such as st_ino always
@@ -63,6 +64,12 @@ rpl_stat (char const *name, struct stat *st)
}
#endif /* REPLACE_FUNC_STAT_FILE */
#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)
{
/* Due to mingw's oddities, there are some directories (like
@@ -77,6 +84,7 @@ rpl_stat (char const *name, struct stat *st)
char fixed_name[PATH_MAX + 1] = {0};
size_t len = strlen (name);
bool check_dir = false;
+ verify (PATH_MAX <= 4096);
if (PATH_MAX <= len)
errno = ENAMETOOLONG;
else if (len)