[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated: warn better if config optio
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated: warn better if config option is invalid, allow second and seconds as time units |
Date: |
Sat, 15 Sep 2018 18:46:08 +0200 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository gnunet.
The following commit(s) were added to refs/heads/master by this push:
new 0850783a1 warn better if config option is invalid, allow second and
seconds as time units
0850783a1 is described below
commit 0850783a17fb39e744fed779b77ad46ac5a4ed54
Author: Christian Grothoff <address@hidden>
AuthorDate: Sat Sep 15 18:45:28 2018 +0200
warn better if config option is invalid, allow second and seconds as time
units
---
src/include/gnunet_common.h | 2 +-
src/util/configuration.c | 18 ++++++++++++++----
src/util/strings.c | 2 ++
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index 1b982cc15..1e9152bbf 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -11,7 +11,7 @@
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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 @@
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Affero General Public License for more details.
-
+
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
@@ -233,7 +233,7 @@ GNUNET_CONFIGURATION_deserialize (struct
GNUNET_CONFIGURATION_Handle *cfg,
GNUNET_asprintf (&fn,
"%s/%s",
basedir,
- value);
+ value);
if (GNUNET_OK !=
GNUNET_CONFIGURATION_parse (cfg,
fn))
@@ -953,12 +953,22 @@ GNUNET_CONFIGURATION_get_value_time (const struct
GNUNET_CONFIGURATION_Handle *c
struct GNUNET_TIME_Relative *time)
{
struct ConfigEntry *e;
+ int ret;
- if (NULL == (e = find_entry (cfg, section, option)))
+ if (NULL == (e = find_entry (cfg,
+ section,
+ option)))
return GNUNET_SYSERR;
if (NULL == e->val)
return GNUNET_SYSERR;
- return GNUNET_STRINGS_fancy_time_to_relative (e->val, time);
+ ret = GNUNET_STRINGS_fancy_time_to_relative (e->val,
+ time);
+ if (GNUNET_OK != ret)
+ GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
+ section,
+ option,
+ _("Not a valid relative time specification"));
+ return ret;
}
diff --git a/src/util/strings.c b/src/util/strings.c
index ea3c8cfb9..e3bdadd39 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -331,6 +331,8 @@ GNUNET_STRINGS_fancy_time_to_relative (const char
*fancy_time,
{ "us", 1},
{ "ms", 1000 },
{ "s", 1000 * 1000LL },
+ { "second", 1000 * 1000LL },
+ { "seconds", 1000 * 1000LL },
{ "\"", 1000 * 1000LL },
{ "m", 60 * 1000 * 1000LL},
{ "min", 60 * 1000 * 1000LL},
--
To stop receiving notification emails like this one, please contact
address@hidden
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] [gnunet] branch master updated: warn better if config option is invalid, allow second and seconds as time units,
gnunet <=