Only use file size for regular files. Allow seeking block devices.
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Thu, 5 Feb 2009 16:34:43 +0000 (18:34 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Thu, 5 Feb 2009 16:37:56 +0000 (18:37 +0200)
Block special files are always seekable. File size is undefined for
non-regular files.

modules/access/file.c

index 9b3315b..80269cc 100644 (file)
@@ -166,9 +166,9 @@ static int Open( vlc_object_t *p_this )
         msg_Dbg (p_access, "ignoring directory");
         goto error;
     }
-
-    p_access->info.i_size = st.st_size;
-    if (!S_ISREG (st.st_mode))
+    if (S_ISREG (st.st_mode))
+        p_access->info.i_size = st.st_size;
+    else if (!S_ISBLK (st.st_mode))
         p_sys->b_seekable = false;
 #else
     p_sys->b_seekable = !b_stdin;