]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/defines.h: Use 'time_t' for DAY
authorAlejandro Colomar <alx@kernel.org>
Wed, 20 Dec 2023 16:56:32 +0000 (17:56 +0100)
committerSerge Hallyn <serge@hallyn.com>
Wed, 27 Dec 2023 15:55:25 +0000 (09:55 -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.

Since this macro expresses a number of seconds, and seconds are in units
of 'time_t' in C, the appropriate type for the multiplication is
'time_t'.

Reported-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/defines.h

index b644036cfb44197c5b3b903558c5763259bb9600..049c0506ced134727cf9075c025661a025e4093a 100644 (file)
 
 /* Solaris defines this in shadow.h */
 #ifndef DAY
-#define DAY (24L*3600L)
+#define DAY  ((time_t) 24 * 3600)
 #endif
 
 #define WEEK (7*DAY)