summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorScott J. Goldman <scottjgo@gmail.com>2012-05-13 23:12:51 -0700
committerScott J. Goldman <scottjgo@gmail.com>2012-05-13 23:12:51 -0700
commit212eb09d5fdf04018478eb375df369f9e7e56b66 (patch)
treed25f03a773e41e49eb432e1d19a5335692838456
parent6fb1c0b489c49b761eeddd655dd01e61d402722d (diff)
downloadlibgit2-212eb09d5fdf04018478eb375df369f9e7e56b66.tar.gz
Add a test to verify FILENAME_MAX
Since we now rely on it (at least under Solaris), I figured we probably want to make sure it's accurate. The new test makes sure that creating a file with a name of length FILENAME_MAX+1 fails.
-rw-r--r--tests-clar/core/dirent.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests-clar/core/dirent.c b/tests-clar/core/dirent.c
index 9c366bf97..5a7859d1b 100644
--- a/tests-clar/core/dirent.c
+++ b/tests-clar/core/dirent.c
@@ -222,3 +222,14 @@ void test_core_dirent__traverse_weird_filenames(void)
check_counts(&odd);
}
+
+/* test filename length limits */
+void test_core_dirent__length_limits(void)
+{
+ char *big_filename = (char *)git__malloc(FILENAME_MAX + 1);
+ memset(big_filename, 'a', FILENAME_MAX + 1);
+ big_filename[FILENAME_MAX] = 0;
+
+ cl_must_fail(p_creat(big_filename, 0666));
+ git__free(big_filename);
+}