rsync/rsync-2.6.3-tzenv.diff

30 lines
702 B
Diff

--- rsync-2.6.5/clientserver.c
+++ rsync-2.6.5/clientserver.c
@@ -360,6 +360,17 @@
* a warning, unless a "require chroot" flag is set,
* in which case we fail.
*/
+ time_t the_time;
+ struct tm* p_tm;
+ char envtz[10];
+ int s_timezone;
+
+ the_time = time(NULL);
+ p_tm = localtime(&the_time);
+ s_timezone = (int)p_tm->tm_gmtoff * -1;
+
+ snprintf(envtz, sizeof(envtz) - 1, "UTC%+d", s_timezone/3600);
+
if (chroot(lp_path(i))) {
rsyserr(FLOG, errno, "chroot %s failed",
safe_fname(lp_path(i)));
@@ -367,6 +378,8 @@
return -1;
}
+ setenv("TZ", envtz, 0);
+
if (!push_dir("/")) {
rsyserr(FLOG, errno, "chdir %s failed\n",
safe_fname(lp_path(i)));