[vlc-commits] access: ACCESS_GET_SIZE return an error if size is unknown

Rémi Denis-Courmont git at videolan.org
Fri Jul 24 15:21:55 CEST 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Jul 24 16:00:48 2015 +0300| [9f873743ec2514c994fc26170acb6efe1ef8c711] | committer: Rémi Denis-Courmont

access: ACCESS_GET_SIZE return an error if size is unknown

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

 modules/access/file.c     |    5 +++--
 modules/access/mms/mmsh.c |    4 +++-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/access/file.c b/modules/access/file.c
index 267c21c..7b05294 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -375,8 +375,9 @@ static int FileControl( access_t *p_access, int i_query, va_list args )
         {
             struct stat st;
 
-            if (fstat (p_sys->fd, &st) == 0)
-                p_sys->size = st.st_size;
+            if (fstat (p_sys->fd, &st))
+                return VLC_EGENERIC;
+            p_sys->size = st.st_size;
             *va_arg( args, uint64_t * ) = p_sys->size;
             break;
         }
diff --git a/modules/access/mms/mmsh.c b/modules/access/mms/mmsh.c
index edf0608..d7d38f6 100644
--- a/modules/access/mms/mmsh.c
+++ b/modules/access/mms/mmsh.c
@@ -242,7 +242,9 @@ static int Control( access_t *p_access, int i_query, va_list args )
         case ACCESS_GET_SIZE:
         {
             uint64_t *s = va_arg( args, uint64_t * );
-            *s = p_sys->b_broadcast ? 0 : p_sys->asfh.i_file_size;
+            if (p_sys->b_broadcast)
+                return VLC_EGENERIC;
+            *s = p_sys->asfh.i_file_size;
             return VLC_SUCCESS;
         }
 



More information about the vlc-commits mailing list