From 7fac308569426c528fea9fdd3201120341f1f49d Mon Sep 17 00:00:00 2001 From: reimar Date: Mon, 23 May 2005 20:12:47 +0000 Subject: Print error when skin file is not readable (e.g. a directory) instead of hanging git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15555 b3059339-0415-0410-9bf9-f77b7e298cf2 --- Gui/skin/skin.c | 6 +++++- help/help_mp-en.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Gui/skin/skin.c b/Gui/skin/skin.c index 3b619ed1a3..cf25a2827f 100644 --- a/Gui/skin/skin.c +++ b/Gui/skin/skin.c @@ -688,7 +688,11 @@ int skinRead( char * dname ) linenumber=0; while ( !feof( skinFile ) ) { - fgets( tmp,255,skinFile ); linenumber++; + if (!fgets( tmp,255,skinFile )) { + mp_msg(MSGT_GPLAYER, MSGL_FATAL, MSGTR_SKIN_SkinFileNotReadable, fn); + return -1; + } + linenumber++; c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; c=tmp[ strlen( tmp ) - 1 ]; if ( c == '\n' || c == '\r' ) tmp[ strlen( tmp ) - 1 ]=0; diff --git a/help/help_mp-en.h b/help/help_mp-en.h index 8b15f4f81f..67f064c96b 100644 --- a/help/help_mp-en.h +++ b/help/help_mp-en.h @@ -641,6 +641,7 @@ static char help_text[]= #define MSGTR_SKIN_WARNING2 "[skin] warning in config file line %d:\nwidget (%s) found but no \"subsection\" found before" #define MSGTR_SKIN_WARNING3 "[skin] warning in config file line %d:\nthis subsection is not supported by widget (%s)" #define MSGTR_SKIN_SkinFileNotFound "[skin] file ( %s ) not found.\n" +#define MSGTR_SKIN_SkinFileNotReadable "[skin] file ( %s ) not readable.\n" #define MSGTR_SKIN_BITMAP_16bit "16 bits or less depth bitmap not supported (%s).\n" #define MSGTR_SKIN_BITMAP_FileNotFound "file not found (%s)\n" #define MSGTR_SKIN_BITMAP_BMPReadError "BMP read error (%s)\n" -- cgit v1.2.3