monit-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[monit-dev] [monit] r334 committed - * AIX: Fix the time display which w


From: monit
Subject: [monit-dev] [monit] r334 committed - * AIX: Fix the time display which was off by GMT difference. Thanks to...
Date: Tue, 01 Mar 2011 19:40:25 +0000

Revision: 334
Author: address@hidden
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);
-
   }

   /*



reply via email to

[Prev in Thread] Current Thread [Next in Thread]