This requires support for fdopendir(). One open() and fstat() calls per
input file are avoided. Ok, this is not such a major improvement).
This should also work around brain-damaged file system drivers such as
Linux HFS+, whereby opendir() succeeds on regular files.
need_libc=false
dnl Check for usual libc functions
-AC_CHECK_FUNCS([ctime_r daemon fcntl fork getenv getpwuid_r gettimeofday isatty lstat memalign posix_fadvise posix_madvise posix_memalign putenv setenv stricmp strnicmp tdestroy uselocale])
+AC_CHECK_FUNCS([ctime_r daemon fcntl fdopendir fork getenv getpwuid_r gettimeofday isatty lstat memalign posix_fadvise posix_madvise posix_memalign putenv setenv stricmp strnicmp tdestroy uselocale])
AC_REPLACE_FUNCS([asprintf atof atoll getcwd getpid gmtime_r lldiv localtime_r rewind strcasecmp strcasestr strdup strlcpy strncasecmp strndup strnlen strsep strtof strtok_r strtoll swab vasprintf])
AC_CHECK_FUNCS(fdatasync,,
[AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.])
* how to parse the data. The directory plugin will do it. */
if (S_ISDIR (st.st_mode))
{
+#ifdef HAVE_FDOPENDIR
+ DIR *handle = fdopendir (fd);
+ if (handle == NULL)
+ goto error; /* Uh? */
+ return DirInit (p_access, handle);
+#else
msg_Dbg (p_access, "ignoring directory");
goto error;
+#endif
}
access_sys_t *p_sys = malloc (sizeof (*p_sys));
void Close (vlc_object_t * p_this)
{
access_t *p_access = (access_t*)p_this;
+
+ if (p_access->pf_read == NULL)
+ {
+ DirClose (p_this);
+ return;
+ }
+
access_sys_t *p_sys = p_access->p_sys;
close (p_sys->fd);