]> andersk Git - moira.git/blobdiff - lib/critical.c
don't overwrite existing '\0' with '\0' in strtrim. (lets us strtrim
[moira.git] / lib / critical.c
index 9bdfd1e54bb64743682129b1622cb9314b77861d..27913d2eccf5ee256f3e1333a5bc73a1448d10fb 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <mit-copyright.h>
 #include <stdio.h>
+#include <sys/types.h>
 #include <sys/file.h>
 #include <moira_site.h>
 #ifdef ZEPHYR
@@ -17,7 +18,9 @@
 #ifdef SYSLOG
 #include <syslog.h>
 #endif
-
+#include <string.h>
+#include <time.h>
+#include <com_err.h>
 
 /* mode to create the file with */
 #define LOGFILEMODE    0644
@@ -31,7 +34,7 @@ extern char *whoami;
  * whoami to be defined and contain the name of the calling program.
  * It's a kludge that it takes a max of 8 arguments in a way that
  * isn't necessarily portable, but varargs doesn't work here and we
- * don't have vsprintf().
+ * don't necessarily have vsprintf().
  */
 
 void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
@@ -51,7 +54,7 @@ void critical_alert(instance, msg, arg1, arg2, arg3, arg4,
     /* Log message to critical file */
     if ((crit = fopen(CRITERRLOG, "a")) != (FILE *)NULL) 
     {
-       long t;
+       time_t t;
        char  *time_s;
 
        time(&t);
@@ -78,11 +81,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;
This page took 0.047253 seconds and 4 git commands to generate.