From 047c61b1fcaab52e62589fe986b59a67180c8657 Mon Sep 17 00:00:00 2001 From: Geoffroy Van Cutsem Date: Mon, 15 Oct 2018 20:27:29 +0200 Subject: [PATCH] verifytime: modify set_time() to take single argument Modify the set_time() function used in verifytime.c to take a single argument instead of two. The second argument that was previously used can easily be derived from the first and it avoids situations where these two are not coherent (which happens to the case in the current version of verifytime.c) Signed-off-by: Geoffroy Van Cutsem --- src/verifytime.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/verifytime.c b/src/verifytime.c index 35133fca..cfd9b860 100644 --- a/src/verifytime.c +++ b/src/verifytime.c @@ -65,13 +65,13 @@ static unsigned long int get_versionstamp(void) return version_num; } -static bool set_time(time_t mtime, char *time) +static bool set_time(time_t mtime) { if (stime(&mtime) != 0) { fprintf(stderr, "Failed to set system time"); return false; } - fprintf(stderr, "Set system time to %s\n", time); + fprintf(stderr, "Set system time to %s\n", ctime(&mtime)); return true; } @@ -96,7 +96,7 @@ int main() * and fallback to using versionstamp time if it does not work or seem reasonable. * The system time wasn't sane, so set it here and try again */ fprintf(stderr, "Warning: Current time is %s\nAttempting to fix...", asctime(timeinfo)); - if (set_time(versiontime, asctime(timeinfo)) == false) { + if (set_time(versiontime) == false) { return 1; } }