changeset 32679:fcd252bdedd0

Don't hardcode filename length. Use limits.h to get the maximum length instead of hardcoding it. Original patch by Sang-Uok Kum. Signed-off-by: Tobias Diedrich <ranma@google.com>
author ranma
date Thu, 06 Jan 2011 14:41:10 +0000
parents c48020f894a2
children cb1961fa7eea
files libmpdemux/mf.c
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/mf.c	Thu Jan 06 14:38:55 2011 +0000
+++ b/libmpdemux/mf.c	Thu Jan 06 14:41:10 2011 +0000
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <limits.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -63,8 +64,8 @@
    FILE *lst_f=fopen(filename + 1,"r");
    if ( lst_f )
     {
-     fname=malloc( 255 );
-     while ( fgets( fname,255,lst_f ) )
+     fname=malloc(PATH_MAX);
+     while ( fgets( fname,PATH_MAX,lst_f ) )
       {
        /* remove spaces from end of fname */
        char *t=fname + strlen( fname ) - 1;