diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-09-15 18:45:28 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-09-15 18:46:06 +0200 |
commit | 0850783a17fb39e744fed779b77ad46ac5a4ed54 (patch) | |
tree | e199593d28db589b6d75b6538133d34d3604697a /src/util/configuration.c | |
parent | e91d46cdbbc97414968fa751fd1f596757c56875 (diff) | |
download | gnunet-0850783a17fb39e744fed779b77ad46ac5a4ed54.tar.gz gnunet-0850783a17fb39e744fed779b77ad46ac5a4ed54.zip |
warn better if config option is invalid, allow second and seconds as time units
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 9a583dfdb..e00bbd64a 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -11,7 +11,7 @@ | |||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | */ | 17 | */ |
@@ -233,7 +233,7 @@ GNUNET_CONFIGURATION_deserialize (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
233 | GNUNET_asprintf (&fn, | 233 | GNUNET_asprintf (&fn, |
234 | "%s/%s", | 234 | "%s/%s", |
235 | basedir, | 235 | basedir, |
236 | value); | 236 | value); |
237 | if (GNUNET_OK != | 237 | if (GNUNET_OK != |
238 | GNUNET_CONFIGURATION_parse (cfg, | 238 | GNUNET_CONFIGURATION_parse (cfg, |
239 | fn)) | 239 | fn)) |
@@ -953,12 +953,22 @@ GNUNET_CONFIGURATION_get_value_time (const struct GNUNET_CONFIGURATION_Handle *c | |||
953 | struct GNUNET_TIME_Relative *time) | 953 | struct GNUNET_TIME_Relative *time) |
954 | { | 954 | { |
955 | struct ConfigEntry *e; | 955 | struct ConfigEntry *e; |
956 | int ret; | ||
956 | 957 | ||
957 | if (NULL == (e = find_entry (cfg, section, option))) | 958 | if (NULL == (e = find_entry (cfg, |
959 | section, | ||
960 | option))) | ||
958 | return GNUNET_SYSERR; | 961 | return GNUNET_SYSERR; |
959 | if (NULL == e->val) | 962 | if (NULL == e->val) |
960 | return GNUNET_SYSERR; | 963 | return GNUNET_SYSERR; |
961 | return GNUNET_STRINGS_fancy_time_to_relative (e->val, time); | 964 | ret = GNUNET_STRINGS_fancy_time_to_relative (e->val, |
965 | time); | ||
966 | if (GNUNET_OK != ret) | ||
967 | GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR, | ||
968 | section, | ||
969 | option, | ||
970 | _("Not a valid relative time specification")); | ||
971 | return ret; | ||
962 | } | 972 | } |
963 | 973 | ||
964 | 974 | ||