clausklein / rpms / tftp

Forked from rpms/tftp 5 years ago
Clone

Blame SOURCES/tftp-hpa-0.39-tzfix.patch

10665a
diff -up tftp-hpa-0.49/tftpd/tftpd.c.tzfix tftp-hpa-0.49/tftpd/tftpd.c
10665a
--- tftp-hpa-0.49/tftpd/tftpd.c.tzfix	2008-10-20 18:08:31.000000000 -0400
10665a
+++ tftp-hpa-0.49/tftpd/tftpd.c	2008-11-25 11:45:27.000000000 -0500
10665a
@@ -350,6 +350,14 @@ int main(int argc, char **argv)
10665a
     const char *pidfile = NULL;
10665a
     u_short tp_opcode;
10665a
 
10665a
+    time_t my_time = 0;
10665a
+    struct tm* p_tm;
10665a
+    char envtz[10];
10665a
+    my_time = time(NULL);
10665a
+    p_tm = localtime(&my_time);
10665a
+    snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", (p_tm->tm_gmtoff * -1)/3600);
10665a
+    setenv("TZ", envtz, 0);
10665a
+
10665a
     /* basename() is way too much of a pain from a portability standpoint */
10665a
 
10665a
     p = strrchr(argv[0], '/');