[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r13502 - gnunet/src/util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r13502 - gnunet/src/util |
Date: |
Tue, 2 Nov 2010 22:12:13 +0100 |
Author: grothoff
Date: 2010-11-02 22:12:13 +0100 (Tue, 02 Nov 2010)
New Revision: 13502
Modified:
gnunet/src/util/configuration.c
Log:
fix
Modified: gnunet/src/util/configuration.c
===================================================================
--- gnunet/src/util/configuration.c 2010-11-02 20:00:31 UTC (rev 13501)
+++ gnunet/src/util/configuration.c 2010-11-02 21:12:13 UTC (rev 13502)
@@ -1017,7 +1017,8 @@
escaped = escape_name (value);
nw = GNUNET_malloc (strlen (old) + strlen (escaped) + 2);
strcpy (nw, old);
- strcat (nw, " ");
+ if (strlen (old) > 0)
+ strcat (nw, " ");
strcat (nw, escaped);
GNUNET_CONFIGURATION_set_value_string (cfg, section, option, nw);
GNUNET_free (old);
@@ -1086,23 +1087,26 @@
}
old = end[0];
end[0] = '\0';
- if (strlen (pos) > 0)
- {
- if (0 == strcmp (pos, match))
- {
- memmove (pos, &end[1], strlen (&end[1]) + 1);
-
- if (pos != list)
- pos[-1] = ' '; /* previously changed to "\0" */
- GNUNET_CONFIGURATION_set_value_string (cfg,
- section, option, list);
- GNUNET_free (list);
- GNUNET_free (match);
- return GNUNET_OK;
- }
- }
+ if (0 == strcmp (pos, match))
+ {
+ if (old != '\0')
+ memmove (pos, &end[1], strlen (&end[1]) + 1);
+ else
+ {
+ if (pos != list)
+ pos[-1] = '\0';
+ else
+ pos[0] = '\0';
+ }
+ GNUNET_CONFIGURATION_set_value_string (cfg,
+ section, option, list);
+ GNUNET_free (list);
+ GNUNET_free (match);
+ return GNUNET_OK;
+ }
if (old == '\0')
break;
+ end[0] = old;
pos = end + 1;
}
GNUNET_free (list);
@@ -1116,7 +1120,7 @@
* system-specific configuration).
*
* @param cfg configuration to update
- * @param filename name of the configuration file
+ * @param filename name of the configuration file, NULL to load defaults
* @return GNUNET_OK on success, GNUNET_SYSERR on error
*/
int
@@ -1139,7 +1143,7 @@
(GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename)))))
{
GNUNET_free (baseconfig);
- return GNUNET_SYSERR;
+ return (filename == NULL) ? GNUNET_OK : GNUNET_SYSERR;
}
GNUNET_free (baseconfig);
if ( ((GNUNET_YES != GNUNET_CONFIGURATION_have_value (cfg,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r13502 - gnunet/src/util,
gnunet <=