]> git.ipfire.org Git - thirdparty/dracut.git/commitdiff
install: avoid non-portable __WORDSIZE
authorAlexander Tsoy <alexander@tsoy.me>
Sat, 8 Sep 2018 23:47:09 +0000 (02:47 +0300)
committerHarald Hoyer <harald@hoyer.xyz>
Mon, 10 Sep 2018 07:45:22 +0000 (09:45 +0200)
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
by any spec. Use explicit size comparisons if we're not interested in the
WORDSIZE, anyway.

Patch ported from systemd.
(commit 8507eb20b64010b26f23822cbf442bb0bf96511c)

Original-patch-by: Emil Renner Berthing <systemd@esmil.dk>
Bug: https://bugs.gentoo.org/602122

install/util.h

index 2ad3254d9f54727733c8a33e8311a25f545558d1..c13b1a2707f75ab9329d4a2fc5a1caf875747002 100644 (file)
@@ -167,7 +167,7 @@ int safe_atoi(const char *s, int *ret_i);
 int safe_atollu(const char *s, unsigned long long *ret_u);
 int safe_atolli(const char *s, long long int *ret_i);
 
-#if __WORDSIZE == 32
+#if LONG_MAX == INT_MAX
 static inline int safe_atolu(const char *s, unsigned long *ret_u) {
         assert_cc(sizeof(unsigned long) == sizeof(unsigned));
         return safe_atou(s, (unsigned*) ret_u);