aboutsummaryrefslogtreecommitdiff
path: root/src/util/configuration.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-11-04 11:17:09 +0100
committerChristian Grothoff <christian@grothoff.org>2018-11-04 11:17:09 +0100
commit3a4e51894442b7fdde457836c6f99d710e47b3f1 (patch)
tree6da5910686ded1c1f6d13423122ab6d60da39911 /src/util/configuration.c
parent31cc8a750f8df10f0a69a8ba9db08a15efa2f415 (diff)
downloadgnunet-3a4e51894442b7fdde457836c6f99d710e47b3f1.tar.gz
gnunet-3a4e51894442b7fdde457836c6f99d710e47b3f1.zip
fix #5454
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r--src/util/configuration.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c
index e00bbd64a..41eb3188d 100644
--- a/src/util/configuration.c
+++ b/src/util/configuration.c
@@ -893,22 +893,27 @@ GNUNET_CONFIGURATION_set_value_number (struct GNUNET_CONFIGURATION_Handle *cfg,
893 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 893 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
894 */ 894 */
895int 895int
896GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle 896GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle *cfg,
897 *cfg, const char *section, 897 const char *section,
898 const char *option, 898 const char *option,
899 unsigned long long *number) 899 unsigned long long *number)
900{ 900{
901 struct ConfigEntry *e; 901 struct ConfigEntry *e;
902 char dummy[2];
902 903
903 if (NULL == (e = find_entry (cfg, section, option))) 904 if (NULL == (e = find_entry (cfg, section, option)))
904 return GNUNET_SYSERR; 905 return GNUNET_SYSERR;
905 if (NULL == e->val) 906 if (NULL == e->val)
906 return GNUNET_SYSERR; 907 return GNUNET_SYSERR;
907 if (1 != SSCANF (e->val, "%llu", number)) 908 if (1 != SSCANF (e->val,
909 "%llu%1s",
910 number,
911 dummy))
908 return GNUNET_SYSERR; 912 return GNUNET_SYSERR;
909 return GNUNET_OK; 913 return GNUNET_OK;
910} 914}
911 915
916
912/** 917/**
913 * Get a configuration value that should be a floating point number. 918 * Get a configuration value that should be a floating point number.
914 * 919 *
@@ -919,18 +924,22 @@ GNUNET_CONFIGURATION_get_value_number (const struct GNUNET_CONFIGURATION_Handle
919 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error 924 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error
920 */ 925 */
921int 926int
922GNUNET_CONFIGURATION_get_value_float (const struct GNUNET_CONFIGURATION_Handle 927GNUNET_CONFIGURATION_get_value_float (const struct GNUNET_CONFIGURATION_Handle *cfg,
923 *cfg, const char *section, 928 const char *section,
924 const char *option, 929 const char *option,
925 float *number) 930 float *number)
926{ 931{
927 struct ConfigEntry *e; 932 struct ConfigEntry *e;
928 933 char dummy[2];
934
929 if (NULL == (e = find_entry (cfg, section, option))) 935 if (NULL == (e = find_entry (cfg, section, option)))
930 return GNUNET_SYSERR; 936 return GNUNET_SYSERR;
931 if (NULL == e->val) 937 if (NULL == e->val)
932 return GNUNET_SYSERR; 938 return GNUNET_SYSERR;
933 if (1 != SSCANF (e->val, "%f", number)) 939 if (1 != SSCANF (e->val,
940 "%f%1s",
941 number,
942 dummy))
934 return GNUNET_SYSERR; 943 return GNUNET_SYSERR;
935 return GNUNET_OK; 944 return GNUNET_OK;
936} 945}