diff options
author | Alessio Vanni <vannilla@firemail.cc> | 2021-04-24 17:29:42 +0200 |
---|---|---|
committer | Alessio Vanni <vannilla@firemail.cc> | 2021-04-24 17:29:42 +0200 |
commit | 8233e282046e27de57de75f175e131a974087618 (patch) | |
tree | fba261f13d3a6225221a42082f561a3152969f82 /src/util/common_logging.c | |
parent | 3cd24823660a0447e590ff352e9da7eb076b292b (diff) | |
download | gnunet-8233e282046e27de57de75f175e131a974087618.tar.gz gnunet-8233e282046e27de57de75f175e131a974087618.zip |
Swap gnunet-config's default behaviour for the rewrite flag
With the previous default, a configuration file could keep values different
from the defaults even when the user did not explicitly edit that option,
potentially leading to buggy behaviour.
For example: GNUnet's version X+1 changes the default value for a certain
option A, but anyone who has edited the configuration file with version X or
earlier, would still have got the old default for A even when updating to
version X+1.
It was possible to write only the edited parts, but that required explicitly
passing the `--rewrite' (or `-w') flag.
The default behaviour has now been swapped so that the resulting file contains
only differences, while a "frozen" configuration is generated with the
`--rewrite' flag.
Also, as it's a minor change: a function used internally by the logging
component was using translated strings to check the requested log level. This
behaviour is buggy as passing an untranslated string to
e.g. `GNUNET_log_setup', while the current locale is different and a
translation for that string exists, would generate a different log level than
the one requested.
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index b30175543..48cc6fe3b 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -246,27 +246,27 @@ static int gnunet_force_log_present; | |||
246 | 246 | ||
247 | /** | 247 | /** |
248 | * Convert a textual description of a loglevel | 248 | * Convert a textual description of a loglevel |
249 | * to the respective GNUNET_GE_KIND. | 249 | * to the respective enumeration type. |
250 | * | 250 | * |
251 | * @param log loglevel to parse | 251 | * @param log loglevel to parse |
252 | * @return GNUNET_GE_INVALID if log does not parse | 252 | * @return GNUNET_ERROR_TYPE_INVALID if log does not parse |
253 | */ | 253 | */ |
254 | static enum GNUNET_ErrorType | 254 | static enum GNUNET_ErrorType |
255 | get_type (const char *log) | 255 | get_type (const char *log) |
256 | { | 256 | { |
257 | if (NULL == log) | 257 | if (NULL == log) |
258 | return GNUNET_ERROR_TYPE_UNSPECIFIED; | 258 | return GNUNET_ERROR_TYPE_UNSPECIFIED; |
259 | if (0 == strcasecmp (log, _ ("DEBUG"))) | 259 | if (0 == strcasecmp (log, "DEBUG")) |
260 | return GNUNET_ERROR_TYPE_DEBUG; | 260 | return GNUNET_ERROR_TYPE_DEBUG; |
261 | if (0 == strcasecmp (log, _ ("INFO"))) | 261 | if (0 == strcasecmp (log, "INFO")) |
262 | return GNUNET_ERROR_TYPE_INFO; | 262 | return GNUNET_ERROR_TYPE_INFO; |
263 | if (0 == strcasecmp (log, _ ("MESSAGE"))) | 263 | if (0 == strcasecmp (log, "MESSAGE")) |
264 | return GNUNET_ERROR_TYPE_MESSAGE; | 264 | return GNUNET_ERROR_TYPE_MESSAGE; |
265 | if (0 == strcasecmp (log, _ ("WARNING"))) | 265 | if (0 == strcasecmp (log, "WARNING")) |
266 | return GNUNET_ERROR_TYPE_WARNING; | 266 | return GNUNET_ERROR_TYPE_WARNING; |
267 | if (0 == strcasecmp (log, _ ("ERROR"))) | 267 | if (0 == strcasecmp (log, "ERROR")) |
268 | return GNUNET_ERROR_TYPE_ERROR; | 268 | return GNUNET_ERROR_TYPE_ERROR; |
269 | if (0 == strcasecmp (log, _ ("NONE"))) | 269 | if (0 == strcasecmp (log, "NONE")) |
270 | return GNUNET_ERROR_TYPE_NONE; | 270 | return GNUNET_ERROR_TYPE_NONE; |
271 | return GNUNET_ERROR_TYPE_INVALID; | 271 | return GNUNET_ERROR_TYPE_INVALID; |
272 | } | 272 | } |