[vlc-devel] commit: Only use file size for regular files. Allow seeking block devices. ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Feb 5 17:40:43 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Thu Feb  5 18:34:43 2009 +0200| [9d4c2ee574c5bf99fc04c1141d96cfdc256b13f7] | committer: Rémi Denis-Courmont 

Only use file size for regular files. Allow seeking block devices.

Block special files are always seekable. File size is undefined for
non-regular files.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d4c2ee574c5bf99fc04c1141d96cfdc256b13f7
---

 modules/access/file.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/access/file.c b/modules/access/file.c
index 9b3315b..80269cc 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -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;




More information about the vlc-devel mailing list