diff options
author | Nils Durner <durner@gnunet.org> | 2009-05-29 21:43:58 +0000 |
---|---|---|
committer | Nils Durner <durner@gnunet.org> | 2009-05-29 21:43:58 +0000 |
commit | 8dbf6bb060caed8132faf75e0d7fec250c9653c1 (patch) | |
tree | 6b60c3412441a043acdd59668e000fdc61cc0bf0 /src/util/common_logging.c | |
parent | f195416e33659a11f16600ac56eded846d419ae8 (diff) | |
download | gnunet-8dbf6bb060caed8132faf75e0d7fec250c9653c1.tar.gz gnunet-8dbf6bb060caed8132faf75e0d7fec250c9653c1.zip |
fix MinGW
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r-- | src/util/common_logging.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 4068ed94b..2fdd17ca7 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c | |||
@@ -123,6 +123,8 @@ static struct CustomLogger *loggers; | |||
123 | */ | 123 | */ |
124 | static unsigned int skip_log; | 124 | static unsigned int skip_log; |
125 | 125 | ||
126 | static FILE *GNUNET_stderr; | ||
127 | |||
126 | /** | 128 | /** |
127 | * Convert a textual description of a loglevel | 129 | * Convert a textual description of a loglevel |
128 | * to the respective GNUNET_GE_KIND. | 130 | * to the respective GNUNET_GE_KIND. |
@@ -163,9 +165,9 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile) | |||
163 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile); | 165 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile); |
164 | return GNUNET_SYSERR; | 166 | return GNUNET_SYSERR; |
165 | } | 167 | } |
166 | if (stderr != NULL) | 168 | if (GNUNET_stderr != NULL) |
167 | fclose (stderr); | 169 | fclose (GNUNET_stderr); |
168 | stderr = altlog; | 170 | GNUNET_stderr = altlog; |
169 | return GNUNET_OK; | 171 | return GNUNET_OK; |
170 | } | 172 | } |
171 | 173 | ||
@@ -220,8 +222,8 @@ output_message (enum GNUNET_ErrorType kind, | |||
220 | const char *comp, const char *datestr, const char *msg) | 222 | const char *comp, const char *datestr, const char *msg) |
221 | { | 223 | { |
222 | struct CustomLogger *pos; | 224 | struct CustomLogger *pos; |
223 | if (stderr != NULL) | 225 | if (GNUNET_stderr != NULL) |
224 | fprintf (stderr, "%s %s %s %s", datestr, comp, | 226 | fprintf (GNUNET_stderr, "%s %s %s %s", datestr, comp, |
225 | GNUNET_error_type_to_string (kind), msg); | 227 | GNUNET_error_type_to_string (kind), msg); |
226 | pos = loggers; | 228 | pos = loggers; |
227 | while (pos != NULL) | 229 | while (pos != NULL) |
@@ -396,6 +398,13 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) | |||
396 | return (const char *) ret.encoding; | 398 | return (const char *) ret.encoding; |
397 | } | 399 | } |
398 | 400 | ||
399 | 401 | /** | |
402 | * Initializer | ||
403 | */ | ||
404 | void __attribute__ ((constructor)) | ||
405 | GNUNET_util_cl_init() | ||
406 | { | ||
407 | GNUNET_stderr = stderr; | ||
408 | } | ||
400 | 409 | ||
401 | /* end of common_logging.c */ | 410 | /* end of common_logging.c */ |