summaryrefslogtreecommitdiff
path: root/source4/heimdal/base/heimbase.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2010-11-29 11:24:08 +1100
committerAndrew Tridgell <tridge@samba.org>2010-12-01 17:00:47 +1100
commitc5bea98ddb2f7967df572160f639da3cba381a87 (patch)
treee5ca502195932ea7674f03a732fc26dd5427553d /source4/heimdal/base/heimbase.c
parent9c84f987acb5ffc97a612839e13e8b8042e6120e (diff)
downloadsamba-c5bea98ddb2f7967df572160f639da3cba381a87.tar.gz
samba-c5bea98ddb2f7967df572160f639da3cba381a87.tar.bz2
samba-c5bea98ddb2f7967df572160f639da3cba381a87.zip
s4:heimdal: import lorikeet-heimdal-201012010201 (commit 81fe27bcc0148d410ca4617f8759b9df1a5e935c)
Diffstat (limited to 'source4/heimdal/base/heimbase.c')
-rw-r--r--source4/heimdal/base/heimbase.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/source4/heimdal/base/heimbase.c b/source4/heimdal/base/heimbase.c
index 137129abb2..b8d5d74a9a 100644
--- a/source4/heimdal/base/heimbase.c
+++ b/source4/heimdal/base/heimbase.c
@@ -60,6 +60,10 @@ struct heim_base_mem {
#define PTR2BASE(ptr) (((struct heim_base *)ptr) - 1)
#define BASE2PTR(ptr) ((void *)(((struct heim_base *)ptr) + 1))
+#ifdef HEIM_BASE_NEED_ATOMIC_MUTEX
+HEIMDAL_MUTEX _heim_base_mutex = HEIMDAL_MUTEX_INITIALIZER;
+#endif
+
/*
* Auto release structure
*/
@@ -334,6 +338,8 @@ heim_base_once_f(heim_base_once_t *once, void *ctx, void (*func)(void *))
} else {
HEIMDAL_MUTEX_unlock(&mutex);
while (1) {
+ struct timeval tv = { 0, 1000 };
+ select(0, NULL, NULL, NULL, &tv);
HEIMDAL_MUTEX_lock(&mutex);
if (*once == 2)
break;
@@ -364,13 +370,10 @@ heim_abort(const char *fmt, ...)
void
heim_abortv(const char *fmt, va_list ap)
{
- char *str = NULL;
- int ret;
+ static char str[1024];
- ret = vasprintf(&str, fmt, ap);
- if (ret > 0 && str) {
- syslog(LOG_ERR, "heim_abort: %s", str);
- }
+ vsnprintf(str, sizeof(str), fmt, ap);
+ syslog(LOG_ERR, "heim_abort: %s", str);
abort();
}