libmpdemux/mf.c: 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>

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32766 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
ranma 2011-01-06 14:41:10 +00:00 committed by Uoti Urpala
parent 2ce17b5afd
commit 1c37a03ac6
1 changed files with 3 additions and 2 deletions

View File

@ -23,6 +23,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -62,8 +63,8 @@ mf_t* open_mf(char * filename){
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;