]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/: Fix long/time_t handling
authorTobias Stoeckmann <tobias@stoeckmann.org>
Thu, 14 Dec 2023 11:11:28 +0000 (12:11 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 5 Jan 2024 21:41:12 +0000 (15:41 -0600)
Special care has to be taken for 32 bit systems with a 64 bit time_t,
since their long data type is still 32 bit.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Link: <https://github.com/shadow-maint/shadow/pull/876>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/pwck.c

index 535ba4e598a81a4ab77a9d752299b92970a2e4a8..2d6bf2c1f361973c44b72c1c027a30bc8e75bc90 100644 (file)
@@ -816,7 +816,7 @@ static void check_spw_file (int *errors, bool *changed)
                if (!quiet) {
                        time_t t = time (NULL);
                        if (   (t != 0)
-                           && (spw->sp_lstchg > (long) t / DAY)) {
+                           && (spw->sp_lstchg > t / DAY)) {
                                printf (_("user %s: last password change in the future\n"),
                                        spw->sp_namp);
                                *errors += 1;