diff options
author | LRN <lrn1986@gmail.com> | 2013-10-14 20:33:13 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2013-10-14 20:33:13 +0000 |
commit | 93cbf8f393a339e0d339089ebbd74423838a6a8f (patch) | |
tree | 4d2dd64c5fd805fbab8451987876c15c4c4c20f9 /src/util/configuration.c | |
parent | 4714da1e50eae60a9ee35ca99a87c1988666cdaf (diff) | |
download | gnunet-93cbf8f393a339e0d339089ebbd74423838a6a8f.tar.gz gnunet-93cbf8f393a339e0d339089ebbd74423838a6a8f.zip |
Don't put back separator that wasn't there originally
Diffstat (limited to 'src/util/configuration.c')
-rw-r--r-- | src/util/configuration.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/util/configuration.c b/src/util/configuration.c index 1e3037878..195c70aa9 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -1054,6 +1054,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1054 | char *def; | 1054 | char *def; |
1055 | char *end; | 1055 | char *end; |
1056 | unsigned int lopen; | 1056 | unsigned int lopen; |
1057 | char erased_char; | ||
1058 | char *erased_pos; | ||
1057 | 1059 | ||
1058 | if (NULL == orig) | 1060 | if (NULL == orig) |
1059 | return NULL; | 1061 | return NULL; |
@@ -1072,6 +1074,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1072 | "Doesn't start with $ - not expanding\n"); | 1074 | "Doesn't start with $ - not expanding\n"); |
1073 | return orig; | 1075 | return orig; |
1074 | } | 1076 | } |
1077 | erased_char = 0; | ||
1078 | erased_pos = NULL; | ||
1075 | if ('{' == orig[1]) | 1079 | if ('{' == orig[1]) |
1076 | { | 1080 | { |
1077 | start = &orig[2]; | 1081 | start = &orig[2]; |
@@ -1098,6 +1102,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1098 | break; | 1102 | break; |
1099 | } | 1103 | } |
1100 | } | 1104 | } |
1105 | erased_char = *end; | ||
1106 | erased_pos = end; | ||
1101 | *end = '\0'; | 1107 | *end = '\0'; |
1102 | post = end + 1; | 1108 | post = end + 1; |
1103 | def = strchr (orig, ':'); | 1109 | def = strchr (orig, ':'); |
@@ -1126,6 +1132,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1126 | } | 1132 | } |
1127 | else | 1133 | else |
1128 | { | 1134 | { |
1135 | erased_char = orig[i]; | ||
1136 | erased_pos = &orig[i]; | ||
1129 | orig[i] = '\0'; | 1137 | orig[i] = '\0'; |
1130 | post = &orig[i + 1]; | 1138 | post = &orig[i + 1]; |
1131 | } | 1139 | } |
@@ -1155,7 +1163,8 @@ expand_dollar (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
1155 | } | 1163 | } |
1156 | if (NULL == env) | 1164 | if (NULL == env) |
1157 | { | 1165 | { |
1158 | orig[strlen (orig)] = DIR_SEPARATOR; | 1166 | if (erased_pos) |
1167 | *erased_pos = erased_char; | ||
1159 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1168 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1160 | "Expanded to `%s' (returning orig)\n", | 1169 | "Expanded to `%s' (returning orig)\n", |
1161 | orig); | 1170 | orig); |