-const char errlog_rcs[] = "$Id: errlog.c,v 1.119 2014/06/02 06:19:05 fabiankeil Exp $";
+const char errlog_rcs[] = "$Id: errlog.c,v 1.125 2016/01/26 17:12:14 diem Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/errlog.c,v $
*********************************************************************/
static long get_thread_id(void)
{
- long this_thread = 1; /* was: pthread_t this_thread;*/
+ long this_thread;
#ifdef __OS2__
PTIB ptib;
this_thread = (long)pthread_self();
#ifdef __MACH__
/*
- * Mac OSX (and perhaps other Mach instances) doesn't have a debuggable
- * value at the first 4 bytes of pthread_self()'s return value, a pthread_t.
- * pthread_t is supposed to be opaque... but it's fairly random, though, so
- * we make it mostly presentable.
+ * Mac OSX (and perhaps other Mach instances) doesn't have a unique
+ * value at the lowest order 4 bytes of pthread_self()'s return value, a pthread_t,
+ * so trim the three lowest-order bytes from the value (16^3).
*/
- this_thread = abs(this_thread % 1000);
+ this_thread = this_thread / 4096;
#endif /* def __MACH__ */
#elif defined(_WIN32)
this_thread = GetCurrentThreadId();
ulrc = DosGetInfoBlocks(&ptib, NULL);
if (ulrc == 0)
this_thread = ptib -> tib_ptib2 -> tib2_ultid;
+#else
+ /* Forking instead of threading. */
+ this_thread = 1;
#endif /* def FEATURE_PTHREAD */
return this_thread;
if (NULL == outbuf_save)
{
- outbuf_save = (char*)zalloc(log_buffer_size + 1); /* +1 for paranoia */
- if (NULL == outbuf_save)
- {
- snprintf(tempbuf, sizeof(tempbuf),
- "%s %08lx Fatal error: Out of memory in log_error().",
- timestamp, thread_id);
- fatal_error(tempbuf); /* Exit */
- return;
- }
+ outbuf_save = zalloc_or_die(log_buffer_size + 1); /* +1 for paranoia */
}
outbuf = outbuf_save;
return "File has been modified outside of the CGI actions editor.";
case JB_ERR_COMPRESS:
return "(De)compression failure";
- default:
- assert(0);
- return "Unknown error";
}
assert(0);
return "Internal error";