Harald Hoyer 9d5d75
From 838f22259a50e5f92429ecdd24b897c1128edc98 Mon Sep 17 00:00:00 2001
Harald Hoyer 9d5d75
From: Alexander Tsoy <alexander@tsoy.me>
Harald Hoyer 9d5d75
Date: Sun, 9 Sep 2018 02:47:09 +0300
Harald Hoyer 9d5d75
Subject: [PATCH] install: avoid non-portable __WORDSIZE
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
Lets not unnecessarily rely on __WORDSIZE, which is not clearly specified
Harald Hoyer 9d5d75
by any spec. Use explicit size comparisons if we're not interested in the
Harald Hoyer 9d5d75
WORDSIZE, anyway.
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
Patch ported from systemd.
Harald Hoyer 9d5d75
(commit 8507eb20b64010b26f23822cbf442bb0bf96511c)
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
Original-patch-by: Emil Renner Berthing <systemd@esmil.dk>
Harald Hoyer 9d5d75
Bug: https://bugs.gentoo.org/602122
Harald Hoyer 9d5d75
---
Harald Hoyer 9d5d75
 install/util.h | 2 +-
Harald Hoyer 9d5d75
 1 file changed, 1 insertion(+), 1 deletion(-)
Harald Hoyer 9d5d75
Harald Hoyer 9d5d75
diff --git a/install/util.h b/install/util.h
Harald Hoyer 9d5d75
index 2ad3254d..c13b1a27 100644
Harald Hoyer 9d5d75
--- a/install/util.h
Harald Hoyer 9d5d75
+++ b/install/util.h
Harald Hoyer 9d5d75
@@ -167,7 +167,7 @@ int safe_atoi(const char *s, int *ret_i);
Harald Hoyer 9d5d75
 int safe_atollu(const char *s, unsigned long long *ret_u);
Harald Hoyer 9d5d75
 int safe_atolli(const char *s, long long int *ret_i);
Harald Hoyer 9d5d75
 
Harald Hoyer 9d5d75
-#if __WORDSIZE == 32
Harald Hoyer 9d5d75
+#if LONG_MAX == INT_MAX
Harald Hoyer 9d5d75
 static inline int safe_atolu(const char *s, unsigned long *ret_u) {
Harald Hoyer 9d5d75
         assert_cc(sizeof(unsigned long) == sizeof(unsigned));
Harald Hoyer 9d5d75
         return safe_atou(s, (unsigned*) ret_u);
Harald Hoyer 9d5d75