[monit-dev] [monit] r334 committed - * AIX: Fix the time display which was off by GMT difference. Thanks to...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[monit-dev] [monit] r334 committed - * AIX: Fix the time display which was off by GMT difference. Thanks to...

monit-2
Revision: 334
Author: [hidden email]
Date: Tue Mar  1 11:39:55 2011
Log: * AIX: Fix the time display which was off by GMT difference. Thanks to
   Helen Chen for report.


http://code.google.com/p/monit/source/detail?r=334

Modified:
  /trunk/CHANGES.txt
  /trunk/env.c

=======================================
--- /trunk/CHANGES.txt Mon Feb 28 08:00:47 2011
+++ /trunk/CHANGES.txt Tue Mar  1 11:39:55 2011
@@ -12,6 +12,9 @@
  * bug #32583: Multiple SIP OPTIONS messages use the same header data.
    Thanks to Hugh Waite for patch.

+* AIX: Fix the time display which was off by GMT difference. Thanks to
+  Helen Chen for report.
+


  Version 5.2.4
=======================================
--- /trunk/env.c Wed Jan 19 10:40:32 2011
+++ /trunk/env.c Tue Mar  1 11:39:55 2011
@@ -154,19 +154,28 @@
    struct stat st;
    extern char **environ;
    char   *path = "PATH=/bin:/usr/bin:/sbin:/usr/sbin";
+  char   buf[STRLEN];
+
+  /*
+   * Keep the TZ variable, the time.h family depends on it at least on AIX
+   */
+  snprintf(buf, sizeof(buf), "TZ=%s", getenv("TZ") ? getenv("TZ") : "");

    /*
     * Purge the environment. Then make sure PATH is set; some shells default
     * to a path with '.' first. You may have to putenv() other stuff, too,
     * but be careful with importing too much.
     */
-  environ[0]= 0;
-
-  if(putenv(path)) {
-
+  environ[0] = 0;
+
+  if (putenv(xstrdup(buf))) {
+    LogError("%s: cannot set the TZ variable -- %s\n", prog, STRERROR);
+    exit(1);
+  }
+
+  if (putenv(path)) {
      LogError("%s: cannot set the PATH variable -- %s\n", prog, STRERROR);
      exit(1);
-
    }

    /*

_______________________________________________
monit-dev mailing list
[hidden email]
http://lists.nongnu.org/mailman/listinfo/monit-dev