X-Git-Url: http://andersk.mit.edu/gitweb/moira.git/blobdiff_plain/8defc06b8af7d99c7b46eaa73d5e9d7c8f044d52..dcfa270ac1d2f55eb793c4da4bbd555903a88b09:/lib/critical.c diff --git a/lib/critical.c b/lib/critical.c index 9bdfd1e5..7d5df7f1 100644 --- a/lib/critical.c +++ b/lib/critical.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #ifdef ZEPHYR @@ -17,6 +18,7 @@ #ifdef SYSLOG #include #endif +#include /* mode to create the file with */ @@ -51,7 +53,7 @@ void critical_alert(instance, msg, arg1, arg2, arg3, arg4, /* Log message to critical file */ if ((crit = fopen(CRITERRLOG, "a")) != (FILE *)NULL) { - long t; + long t, time(); char *time_s; time(&t); @@ -78,11 +80,15 @@ char *msg; #ifdef ZEPHYR ZNotice_t znotice; +#ifdef POSIX + memset (&znotice, 0, sizeof (znotice)); +#else bzero (&znotice, sizeof (znotice)); +#endif znotice.z_kind = UNSAFE; znotice.z_class = "MOIRA"; znotice.z_class_inst = inst; - znotice.z_default_format = "MOIRA $instance:\n $message\n"; + znotice.z_default_format = "MOIRA $instance on $fromhost:\n $message\n"; (void) ZInitialize (); znotice.z_message = msg; znotice.z_message_len = strlen(msg) + 1;