Mercurial > mplayer.hg
comparison mplayer.c @ 34172:5761a9a31bcb
Sanitize include option behaviour.
If the file could not be opened/read/processed, print a message and
quit instead of completely silently ignoring it.
author | reimar |
---|---|
date | Tue, 25 Oct 2011 20:45:09 +0000 |
parents | 3959e81b0bcb |
children | aa8061d708b9 |
comparison
equal
deleted
inserted
replaced
34171:cca4f430b0f4 | 34172:5761a9a31bcb |
---|---|
857 static void parse_cfgfiles(m_config_t *conf) | 857 static void parse_cfgfiles(m_config_t *conf) |
858 { | 858 { |
859 char *conffile; | 859 char *conffile; |
860 int conffile_fd; | 860 int conffile_fd; |
861 if (!disable_system_conf && | 861 if (!disable_system_conf && |
862 m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mplayer.conf") < 0) | 862 m_config_parse_config_file(conf, MPLAYER_CONFDIR "/mplayer.conf", 1) < 0) |
863 exit_player(EXIT_NONE); | 863 exit_player(EXIT_NONE); |
864 if ((conffile = get_path("")) == NULL) { | 864 if ((conffile = get_path("")) == NULL) { |
865 mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoHomeDir); | 865 mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_NoHomeDir); |
866 } else { | 866 } else { |
867 #ifdef __MINGW32__ | 867 #ifdef __MINGW32__ |
877 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_CreatingCfgFile, conffile); | 877 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_CreatingCfgFile, conffile); |
878 write(conffile_fd, default_config, strlen(default_config)); | 878 write(conffile_fd, default_config, strlen(default_config)); |
879 close(conffile_fd); | 879 close(conffile_fd); |
880 } | 880 } |
881 if (!disable_user_conf && | 881 if (!disable_user_conf && |
882 m_config_parse_config_file(conf, conffile) < 0) | 882 m_config_parse_config_file(conf, conffile, 1) < 0) |
883 exit_player(EXIT_NONE); | 883 exit_player(EXIT_NONE); |
884 free(conffile); | 884 free(conffile); |
885 } | 885 } |
886 } | 886 } |
887 } | 887 } |
954 { | 954 { |
955 struct stat st; | 955 struct stat st; |
956 if (stat(file, &st)) | 956 if (stat(file, &st)) |
957 return 0; | 957 return 0; |
958 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_LoadingConfig, file); | 958 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_LoadingConfig, file); |
959 m_config_parse_config_file(conf, file); | 959 m_config_parse_config_file(conf, file, 0); |
960 return 1; | 960 return 1; |
961 } | 961 } |
962 | 962 |
963 static void load_per_file_config(m_config_t *conf, const char *const file) | 963 static void load_per_file_config(m_config_t *conf, const char *const file) |
964 { | 964 { |