Fix error reporting.
Showing
1 changed file
with
29 additions
and
6 deletions
... | @@ -87,15 +87,23 @@ int | ... | @@ -87,15 +87,23 @@ int |
87 | mu_parse_config_files (struct mu_cfg_param *param, void *target) | 87 | mu_parse_config_files (struct mu_cfg_param *param, void *target) |
88 | { | 88 | { |
89 | int flags = 0; | 89 | int flags = 0; |
90 | 90 | int rc; | |
91 | |||
91 | if (mu_cfg_parser_verbose) | 92 | if (mu_cfg_parser_verbose) |
92 | flags |= MU_PARSE_CONFIG_VERBOSE; | 93 | flags |= MU_PARSE_CONFIG_VERBOSE; |
93 | if (mu_cfg_parser_verbose > 1) | 94 | if (mu_cfg_parser_verbose > 1) |
94 | flags |= MU_PARSE_CONFIG_DUMP; | 95 | flags |= MU_PARSE_CONFIG_DUMP; |
95 | 96 | ||
96 | if (mu_load_site_rcfile) | 97 | if (mu_load_site_rcfile) |
97 | mu_parse_config (MU_CONFIG_FILE, mu_program_name, param, | 98 | { |
98 | flags | MU_PARSE_CONFIG_GLOBAL, target); | 99 | rc = mu_parse_config (MU_CONFIG_FILE, mu_program_name, param, |
100 | flags | MU_PARSE_CONFIG_GLOBAL, target); | ||
101 | if (rc == ENOMEM) | ||
102 | { | ||
103 | mu_error ("%s", mu_strerror (rc)); | ||
104 | return rc; | ||
105 | } | ||
106 | } | ||
99 | 107 | ||
100 | if (mu_load_user_rcfile && mu_program_name) | 108 | if (mu_load_user_rcfile && mu_program_name) |
101 | { | 109 | { |
... | @@ -106,14 +114,29 @@ mu_parse_config_files (struct mu_cfg_param *param, void *target) | ... | @@ -106,14 +114,29 @@ mu_parse_config_files (struct mu_cfg_param *param, void *target) |
106 | strcpy (file_name, "~/."); | 114 | strcpy (file_name, "~/."); |
107 | strcat (file_name, mu_program_name); | 115 | strcat (file_name, mu_program_name); |
108 | 116 | ||
109 | mu_parse_config (file_name, mu_program_name, param, flags, target); | 117 | rc = mu_parse_config (file_name, mu_program_name, param, flags, |
118 | target); | ||
119 | if (rc == ENOMEM) | ||
120 | { | ||
121 | mu_error ("%s", mu_strerror (rc)); | ||
122 | return rc; | ||
123 | } | ||
110 | 124 | ||
111 | free (file_name); | 125 | free (file_name); |
112 | } | 126 | } |
113 | } | 127 | } |
114 | 128 | ||
115 | if (mu_load_rcfile) | 129 | if (mu_load_rcfile) |
116 | mu_parse_config (mu_load_rcfile, mu_program_name, param, flags, target); | 130 | { |
117 | 131 | rc = mu_parse_config (mu_load_rcfile, mu_program_name, param, | |
132 | flags, target); | ||
133 | if (rc) | ||
134 | { | ||
135 | mu_error (_("Cannot open file %s: %s"), mu_load_rcfile, | ||
136 | mu_strerror (rc)); | ||
137 | return rc; | ||
138 | } | ||
139 | } | ||
140 | |||
118 | return 0; | 141 | return 0; |
119 | } | 142 | } | ... | ... |
-
Please register or sign in to post a comment