[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3273 - in GNUnet/src/util: error os string
From: |
grothoff |
Subject: |
[GNUnet-SVN] r3273 - in GNUnet/src/util: error os string |
Date: |
Sun, 20 Aug 2006 14:15:22 -0700 (PDT) |
Author: grothoff
Date: 2006-08-20 14:15:18 -0700 (Sun, 20 Aug 2006)
New Revision: 3273
Modified:
GNUnet/src/util/error/error.c
GNUnet/src/util/os/dso.c
GNUnet/src/util/string/Makefile.am
GNUnet/src/util/string/xmalloctest.c
Log:
fixes
Modified: GNUnet/src/util/error/error.c
===================================================================
--- GNUnet/src/util/error/error.c 2006-08-20 20:32:58 UTC (rev 3272)
+++ GNUnet/src/util/error/error.c 2006-08-20 21:15:18 UTC (rev 3273)
@@ -57,27 +57,43 @@
GE_KIND kind,
const char * message,
...) {
+ va_list va;
char date[64];
time_t timetmp;
struct tm * tmptr;
+ size_t size;
+ char * buf;
if (ctx == NULL)
ctx = defaultContext;
- if (ctx == NULL)
+ if ( (ctx != NULL) &&
+ (! GE_applies(kind, ctx->mask)) )
return;
- if (! GE_applies(kind, ctx->mask))
- return;
+ va_start(va, message);
+ size = vsnprintf(NULL, 0, message, va) + 1;
+ va_end(va);
+ buf = malloc(size);
+ va_start(va, message);
+ vsnprintf(buf, size, message, va);
+ va_end(va);
time(&timetmp);
tmptr = localtime(&timetmp);
- if (0 != strftime(date,
- 64,
- "%b %d %H:%M:%S",
- tmptr))
- abort();
- ctx->handler(ctx->cls,
- kind,
- date,
- message);
+ memset(date, 0, 64);
+ strftime(date,
+ 64,
+ "%b %d %H:%M:%S",
+ tmptr);
+ if (ctx != NULL)
+ ctx->handler(ctx->cls,
+ kind,
+ date,
+ buf);
+ else
+ fprintf(stderr,
+ "%s %s",
+ date,
+ buf);
+ free(buf);
}
/**
Modified: GNUnet/src/util/os/dso.c
===================================================================
--- GNUnet/src/util/os/dso.c 2006-08-20 20:32:58 UTC (rev 3272)
+++ GNUnet/src/util/os/dso.c 2006-08-20 21:15:18 UTC (rev 3273)
@@ -69,8 +69,9 @@
(lnk[size-4] != '/') ) {
GE_LOG(NULL,
GE_ERROR | GE_USER | GE_ADMIN | GE_IMMEDIATE,
- _("Cannot determine plugin path, application must be installed in
directory ending with `%s'.\n"),
- "bin/");
+ _("Cannot determine plugin path (have, application must be installed
in directory ending with `%s', have `%s').\n"),
+ "bin/",
+ lnk);
FREE(lnk);
return NULL;
}
@@ -85,7 +86,9 @@
path = MALLOC(4097);
GetModuleFileName(NULL, path, 4096);
idx = path + strlen(idx);
- while(idx > path && path != '\\' && path != '/')
+ while ( (idx > path) &&
+ (path != '\\') &&
+ (path != '/') )
idx++;
*idx = 0;
@@ -114,8 +117,13 @@
if (opath != NULL)
old_dlsearchpath = STRDUP(opath);
path = getPluginPath();
+ if (path == NULL) {
+ fprintf(stderr,
+ _("Fatal error: could not determine path for plugins!\n"));
+ abort();
+ }
lt_dlsetsearchpath(path);
- FREE(path);
+ FREE(path);
}
void __attribute__ ((destructor)) gnc_ltdl_fini(void) {
Modified: GNUnet/src/util/string/Makefile.am
===================================================================
--- GNUnet/src/util/string/Makefile.am 2006-08-20 20:32:58 UTC (rev 3272)
+++ GNUnet/src/util/string/Makefile.am 2006-08-20 21:15:18 UTC (rev 3273)
@@ -17,5 +17,5 @@
xmalloctest_SOURCES = \
xmalloctest.c
xmalloctest_LDADD = \
- $(top_builddir)/src/util/string/libstring.la
+ $(top_builddir)/src/util/libgnunetutil.la
Modified: GNUnet/src/util/string/xmalloctest.c
===================================================================
--- GNUnet/src/util/string/xmalloctest.c 2006-08-20 20:32:58 UTC (rev
3272)
+++ GNUnet/src/util/string/xmalloctest.c 2006-08-20 21:15:18 UTC (rev
3273)
@@ -1,10 +1,29 @@
+/*
+ This file is part of GNUnet.
+ (C) 2001, 2002, 2003, 2005, 2006 Christian Grothoff (and other
contributing authors)
+
+ GNUnet is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published
+ by the Free Software Foundation; either version 2, or (at your
+ option) any later version.
+
+ GNUnet is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GNUnet; see the file COPYING. If not, write to the
+ Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+*/
+
/**
- * @file test/xmalloctest.c
- * @brief testcase for util/xmalloc.c
+ * @file util/string/xmalloctest.c
+ * @brief testcase for util/string/xmalloc.c
*/
#include "gnunet_util.h"
-#include "gnunet_util_string.h"
#include "platform.h"
static int check() {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3273 - in GNUnet/src/util: error os string,
grothoff <=