summaryrefslogtreecommitdiff
path: root/src/factory-reset.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/factory-reset.c')
-rw-r--r--src/factory-reset.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/factory-reset.c b/src/factory-reset.c
index 6e06ab6..0828b85 100644
--- a/src/factory-reset.c
+++ b/src/factory-reset.c
@@ -247,7 +247,12 @@ int main(int argc, char **argv)
int i = 0, c;
const char *reset_cmd[] = {RUN_SCRIPT_FILE, NULL, NULL};
time_t t = time(NULL);
- struct tm tm2 = *localtime(&t);
+
+ struct tm lt;
+ if (localtime_r(&t, &lt) == NULL) {
+ perror("localtime_r() error");
+ return -1;
+ }
static struct option long_options[] = {
{"dbus", no_argument, NULL, 'b'},
@@ -322,8 +327,8 @@ int main(int argc, char **argv)
// write finish log file
fprintf(fp, "End Factory Reset\n%d-%02d-%02d %02d:%02d:%02d\n",
- tm2.tm_year + 1900, tm2.tm_mon + 1, tm2.tm_mday,
- tm2.tm_hour, tm2.tm_min, tm2.tm_sec);
+ lt.tm_year + 1900, lt.tm_mon + 1, lt.tm_mday,
+ lt.tm_hour, lt.tm_min, lt.tm_sec);
fclose(fp);
// remove reset flag file, sync and reboot