[vlc-devel] [PATCH v2 11/18] configure: Test if pathconf exists
Dennis Hamester
dhamester at jusst.de
Mon Mar 13 12:36:57 CET 2017
From: Dennis Hamester <dennis.hamester at startmail.com>
Some platforms (NaCl for example) don't support pathconf.
---
configure.ac | 2 +-
src/posix/filesystem.c | 8 +++++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 0d1ab88498..c9713970fd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -594,7 +594,7 @@ dnl Check for system libs needed
need_libc=false
dnl Check for usual libc functions
-AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime tdestroy uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock])
+AC_CHECK_FUNCS([daemon fcntl flock fstatvfs fork getenv getpwuid_r isatty lstat memalign mkostemp mmap open_memstream openat pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime tdestroy uselocale pthread_cond_timedwait_monotonic_np pthread_condattr_setclock pathconf])
AC_REPLACE_FUNCS([atof atoll dirfd fdopendir ffsll flockfile fsync getdelim getpid lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tfind timegm timespec_get strverscmp])
AC_REPLACE_FUNCS([gettimeofday])
AC_CHECK_FUNC(fdatasync,,
diff --git a/src/posix/filesystem.c b/src/posix/filesystem.c
index f4d0e2691f..f3e09f8fd9 100644
--- a/src/posix/filesystem.c
+++ b/src/posix/filesystem.c
@@ -187,7 +187,13 @@ int vlc_rename (const char *oldpath, const char *newpath)
char *vlc_getcwd (void)
{
- long path_max = pathconf (".", _PC_PATH_MAX);
+ long path_max;
+#ifdef HAVE_PATHCONF
+ path_max = pathconf (".", _PC_PATH_MAX);
+#else
+ path_max = -1;
+#endif
+
size_t size = (path_max == -1 || path_max > 4096) ? 4096 : path_max;
for (;; size *= 2)
--
2.12.0
More information about the vlc-devel
mailing list