changeset 15554:e93d0faac02b

Print error when skin file is not readable (e.g. a directory) instead of hanging
author reimar
date Mon, 23 May 2005 20:12:47 +0000
parents 43af13780751
children 806cd20f1c8f
files Gui/skin/skin.c help/help_mp-en.h
diffstat 2 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Gui/skin/skin.c	Mon May 23 16:20:46 2005 +0000
+++ b/Gui/skin/skin.c	Mon May 23 20:12:47 2005 +0000
@@ -688,7 +688,11 @@
  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;
--- a/help/help_mp-en.h	Mon May 23 16:20:46 2005 +0000
+++ b/help/help_mp-en.h	Mon May 23 20:12:47 2005 +0000
@@ -641,6 +641,7 @@
 #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"