mirror of
https://github.com/troglobit/finit.git
synced 2026-11-07 16:01:08 +00:00
Default to set TZ=UTC0 for RTC plugin
This patch sets the TZ variable to a sane default, UTC. Fixing, at least, the time restore problems of the RTC plugin. Also, let the C library figure out DST, as the docs say -1 does ... Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
5fd5e722a8
commit
54fd38adcc
2 files changed
+6
-1
No files matched your search
@@ -118,6 +118,7 @@ static void rtc_restore(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
print_desc(NULL, "Restoring system clock (UTC) from RTC");
|
print_desc(NULL, "Restoring system clock (UTC) from RTC");
|
||||||
|
tm.tm_isdst = -1; /* Use tzdata to figure it out, please. */
|
||||||
tv.tv_sec = mktime(&tm);
|
tv.tv_sec = mktime(&tm);
|
||||||
if (tv.tv_sec < RTC_TIMESTAMP_BEGIN_2000) {
|
if (tv.tv_sec < RTC_TIMESTAMP_BEGIN_2000) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
|
|||||||
+5
-1
@@ -30,6 +30,7 @@
|
|||||||
#include <fstab.h>
|
#include <fstab.h>
|
||||||
#endif
|
#endif
|
||||||
#include <mntent.h>
|
#include <mntent.h>
|
||||||
|
#include <time.h> /* tzet() */
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
#include <sys/stat.h> /* umask(), mkdir() */
|
#include <sys/stat.h> /* umask(), mkdir() */
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
@@ -319,11 +320,14 @@ int main(int argc, char *argv[])
|
|||||||
ctx = &loop;
|
ctx = &loop;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set PATH, SHELL, PWD and umask early to something sane
|
* Set PATH, SHELL, PWD, TZ and umask early to something sane
|
||||||
*/
|
*/
|
||||||
setenv("PATH", _PATH_STDPATH, 1);
|
setenv("PATH", _PATH_STDPATH, 1);
|
||||||
setenv("SHELL", _PATH_BSHELL, 1);
|
setenv("SHELL", _PATH_BSHELL, 1);
|
||||||
|
|
||||||
|
setenv("TZ", "UTC0", 1);
|
||||||
|
tzset();
|
||||||
|
|
||||||
chdir("/");
|
chdir("/");
|
||||||
umask(0);
|
umask(0);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user