#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#endif
-#if defined (__linux__)
-# include <sys/vfs.h>
+#ifdef HAVE_FSTATVFS
+# include <sys/statvfs.h>
+# if defined (HAVE_SYS_MOUNT_H)
+# include <sys/param.h>
+# include <sys/mount.h>
+# endif
+#endif
#ifdef HAVE_LINUX_MAGIC_H
+# include <sys/vfs.h>
# include <linux/magic.h>
#endif
-#elif defined (HAVE_SYS_MOUNT_H)
-# include <sys/param.h>
-# include <sys/mount.h>
-#endif
#if defined( WIN32 )
# include <io.h>
#ifndef WIN32
static bool IsRemote (int fd)
{
-#ifdef HAVE_FSTATFS
+#if defined (HAVE_FSTATVFS) && defined (MNT_LOCAL)
+ struct statvfs stf;
+
+ if (fstatvfs (fd, &stf))
+ return false;
+ /* fstatvfs() is in POSIX, but MNT_LOCAL is not */
+ return !(stf.f_flag & MNT_LOCAL);
+
+#elif defined (HAVE_LINUX_MAGIC_H)
struct statfs stf;
if (fstatfs (fd, &stf))
return false;
-#if defined(MNT_LOCAL)
- return !(stf.f_flags & MNT_LOCAL);
-
-#else
-# ifdef HAVE_LINUX_MAGIC_H
- switch (stf.f_type)
+ switch ((unsigned long)stf.f_type)
{
case AFS_SUPER_MAGIC:
case CODA_SUPER_MAGIC:
return true;
}
return false;
-# endif
-#endif
-#else /* !HAVE_FSTATFS */
+
+#else
(void)fd;
return false;
int Open( vlc_object_t *p_this )
{
access_t *p_access = (access_t*)p_this;
- const char *path = p_access->psz_path;
#ifdef WIN32
bool is_remote = false;
#endif
if (!strcasecmp (p_access->psz_access, "fd"))
{
char *end;
- int oldfd = strtol (path, &end, 10);
+ int oldfd = strtol (p_access->psz_location, &end, 10);
if (*end == '\0')
fd = vlc_dup (oldfd);
- else if (*end == '/' && end > path)
+ else if (*end == '/' && end > p_access->psz_location)
{
char *name = decode_URI_duplicate (end - 1);
if (name != NULL)
}
else
{
+ const char *path = p_access->psz_filepath;
+
msg_Dbg (p_access, "opening file `%s'", path);
fd = vlc_open (path, O_RDONLY | O_NONBLOCK);
if (fd == -1)
p_access->p_sys = p_sys;
p_sys->i_nb_reads = 0;
p_sys->fd = fd;
- p_sys->caching = var_CreateGetInteger (p_access, "file-caching");
+ p_sys->caching = var_InheritInteger (p_access, "file-caching");
if (IsRemote(fd))
- p_sys->caching += var_CreateGetInteger (p_access, "network-caching");
+ p_sys->caching += var_InheritInteger (p_access, "network-caching");
p_sys->b_pace_control = true;
if (S_ISREG (st.st_mode))