aboutsummaryrefslogtreecommitdiff
path: root/src/util/test_configuration.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-11-22 19:06:54 +0000
committerChristian Grothoff <christian@grothoff.org>2009-11-22 19:06:54 +0000
commit12586cd08b2d8f797ef1a63501def72d5c875cf8 (patch)
tree8eb8cf55b8f6f5b5d3150df3d885d5b58cc3f0fb /src/util/test_configuration.c
parent02f21c08e22a6b04030b4eb990fa5046e79e00b3 (diff)
downloadgnunet-12586cd08b2d8f797ef1a63501def72d5c875cf8.tar.gz
gnunet-12586cd08b2d8f797ef1a63501def72d5c875cf8.zip
fixes
Diffstat (limited to 'src/util/test_configuration.c')
-rw-r--r--src/util/test_configuration.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/util/test_configuration.c b/src/util/test_configuration.c
index 609f797bd..7d87d03a8 100644
--- a/src/util/test_configuration.c
+++ b/src/util/test_configuration.c
@@ -117,6 +117,8 @@ diffsCallBack (void *cls,
117 { 117 {
118 int ret; 118 int ret;
119 char *diffValue; 119 char *diffValue;
120
121 diffValue = NULL;
120 ret = 122 ret =
121 GNUNET_CONFIGURATION_get_value_string (cbData->cfgDiffs, section, 123 GNUNET_CONFIGURATION_get_value_string (cbData->cfgDiffs, section,
122 option, &diffValue); 124 option, &diffValue);
@@ -127,6 +129,7 @@ diffsCallBack (void *cls,
127 } 129 }
128 else 130 else
129 cbData->status = 1; 131 cbData->status = 1;
132 GNUNET_free_non_null (diffValue);
130 break; 133 break;
131 } 134 }
132#if DEBUG 135#if DEBUG
@@ -180,6 +183,7 @@ editConfiguration (struct GNUNET_CONFIGURATION_Handle *cfg, int option)
180 GNUNET_CONFIGURATION_set_value_string (diffsCB.cfgDiffs, 183 GNUNET_CONFIGURATION_set_value_string (diffsCB.cfgDiffs,
181 "new-section", key, 184 "new-section", key,
182 "new-value"); 185 "new-value");
186 GNUNET_free (key);
183 } 187 }
184 break; 188 break;
185 } 189 }
@@ -209,12 +213,15 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option)
209 initDiffsCBData (&cbData); 213 initDiffsCBData (&cbData);
210 214
211 cfg = GNUNET_CONFIGURATION_create (); 215 cfg = GNUNET_CONFIGURATION_create ();
212 GNUNET_CONFIGURATION_load (cfg, NULL); 216 /* load defaults */
217 GNUNET_assert (GNUNET_OK == GNUNET_CONFIGURATION_load (cfg, NULL));
213 218
214 /* Modify configuration and save it */ 219 /* Modify configuration and save it */
215 cfgDiffs = editConfiguration (cfg, option); 220 cfgDiffs = editConfiguration (cfg, option);
216 diffsFileName = 221 diffsFileName =
217 GNUNET_DISK_mktemp ("gnunet-test-configurations-diffs.conf"); 222 GNUNET_DISK_mktemp ("gnunet-test-configurations-diffs.conf");
223 if (diffsFileName == NULL)
224 return 1;
218 GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg, diffsFileName); 225 GNUNET_CONFIGURATION_write_diffs (cfgDefault, cfg, diffsFileName);
219 GNUNET_CONFIGURATION_destroy (cfg); 226 GNUNET_CONFIGURATION_destroy (cfg);
220 227
@@ -225,7 +232,7 @@ checkDiffs (struct GNUNET_CONFIGURATION_Handle *cfgDefault, int option)
225 cbData.callBackOption = COMPARE; 232 cbData.callBackOption = COMPARE;
226 cbData.cfgDiffs = cfgDiffs; 233 cbData.cfgDiffs = cfgDiffs;
227 GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData); 234 GNUNET_CONFIGURATION_iterate (cfg, diffsCallBack, &cbData);
228 if ((ret = cbData.status) == 1) 235 if (1 == (ret = cbData.status))
229 { 236 {
230 fprintf (stderr, 237 fprintf (stderr,
231 "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n"); 238 "Incorrect Configuration Diffs: Diffs may contain data not actually edited\n");
@@ -249,6 +256,7 @@ housekeeping:
249#endif 256#endif
250 GNUNET_CONFIGURATION_destroy (cfg); 257 GNUNET_CONFIGURATION_destroy (cfg);
251 GNUNET_CONFIGURATION_destroy (cfgDiffs); 258 GNUNET_CONFIGURATION_destroy (cfgDiffs);
259 GNUNET_free (diffsFileName);
252 return ret; 260 return ret;
253} 261}
254 262