Commit 2c54f289 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

fdopendir does not imply openat (fix #3505)

parent 9e8bf209
...@@ -548,7 +548,7 @@ dnl Check for system libs needed ...@@ -548,7 +548,7 @@ dnl Check for system libs needed
need_libc=false need_libc=false
dnl Check for usual libc functions dnl Check for usual libc functions
AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fork getenv getpwuid_r gettimeofday isatty lstat memalign posix_fadvise posix_madvise posix_memalign putenv setenv setlocale stricmp strnicmp tdestroy uselocale]) AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fork getenv getpwuid_r gettimeofday isatty lstat memalign openat posix_fadvise posix_madvise posix_memalign putenv setenv setlocale stricmp strnicmp tdestroy uselocale])
AC_REPLACE_FUNCS([asprintf atof atoll getcwd getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab vasprintf]) AC_REPLACE_FUNCS([asprintf atof atoll getcwd getdelim getpid gmtime_r lldiv localtime_r nrand48 rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab vasprintf])
AC_CHECK_FUNCS(fdatasync,, AC_CHECK_FUNCS(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.]) [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
......
...@@ -76,7 +76,7 @@ struct directory_t ...@@ -76,7 +76,7 @@ struct directory_t
#ifndef WIN32 #ifndef WIN32
struct stat st; struct stat st;
#endif #endif
#ifndef HAVE_FDOPENDIR #ifndef HAVE_OPENAT
char *path; char *path;
#endif #endif
}; };
...@@ -175,7 +175,7 @@ void DirClose( vlc_object_t * p_this ) ...@@ -175,7 +175,7 @@ void DirClose( vlc_object_t * p_this )
p_sys->current = current->parent; p_sys->current = current->parent;
closedir (current->handle); closedir (current->handle);
free (current->uri); free (current->uri);
#ifndef HAVE_FDOPENDIR #ifndef HAVE_OPENAT
free (current->path); free (current->path);
#endif #endif
free (current); free (current);
...@@ -237,7 +237,7 @@ block_t *DirBlock (access_t *p_access) ...@@ -237,7 +237,7 @@ block_t *DirBlock (access_t *p_access)
} }
current->parent = NULL; current->parent = NULL;
current->handle = p_sys->handle; current->handle = p_sys->handle;
#ifndef HAVE_FDOPENDIR #ifndef HAVE_OPENAT
current->path = strdup (p_access->psz_path); current->path = strdup (p_access->psz_path);
#endif #endif
current->uri = p_sys->uri; current->uri = p_sys->uri;
...@@ -260,7 +260,7 @@ block_t *DirBlock (access_t *p_access) ...@@ -260,7 +260,7 @@ block_t *DirBlock (access_t *p_access)
closedir (current->handle); closedir (current->handle);
p_sys->current = current->parent; p_sys->current = current->parent;
free (current->uri); free (current->uri);
#ifndef HAVE_FDOPENDIR #ifndef HAVE_OPENAT
free (current->path); free (current->path);
#endif #endif
free (current); free (current);
...@@ -315,7 +315,7 @@ block_t *DirBlock (access_t *p_access) ...@@ -315,7 +315,7 @@ block_t *DirBlock (access_t *p_access)
} }
DIR *handle; DIR *handle;
#ifdef HAVE_FDOPENDIR #ifdef HAVE_OPENAT
int fd = vlc_openat (dirfd (current->handle), entry, O_RDONLY); int fd = vlc_openat (dirfd (current->handle), entry, O_RDONLY);
if (fd != -1) if (fd != -1)
{ {
......
...@@ -145,7 +145,6 @@ int Open( vlc_object_t *p_this ) ...@@ -145,7 +145,6 @@ int Open( vlc_object_t *p_this )
if (*end == '\0') if (*end == '\0')
fd = vlc_dup (oldfd); fd = vlc_dup (oldfd);
#ifdef HAVE_FDOPENDIR
else if (*end == '/' && end > path) else if (*end == '/' && end > path)
{ {
char *name = decode_URI_duplicate (end - 1); char *name = decode_URI_duplicate (end - 1);
...@@ -156,7 +155,6 @@ int Open( vlc_object_t *p_this ) ...@@ -156,7 +155,6 @@ int Open( vlc_object_t *p_this )
free (name); free (name);
} }
} }
#endif
} }
else else
{ {
......
...@@ -225,7 +225,7 @@ int vlc_openat (int dir, const char *filename, int flags, ...) ...@@ -225,7 +225,7 @@ int vlc_openat (int dir, const char *filename, int flags, ...)
return -1; return -1;
} }
#ifdef HAVE_FDOPENDIR #ifdef HAVE_OPENAT
int fd = openat (dir, local_name, flags, mode); int fd = openat (dir, local_name, flags, mode);
# ifdef HAVE_FCNTL # ifdef HAVE_FCNTL
if (fd != -1) if (fd != -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment