From 467d19bcd43c18b6a1f77b258912ae0a37cda6b2 Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 28 Sep 2020 10:51:50 +0900 Subject: [PATCH] Use atoll() to parse system_identifier on 32bit systems Addresses issue in GitHub #665. --- dbutils.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dbutils.c b/dbutils.c index 5f5d5362..9ad77a2e 100644 --- a/dbutils.c +++ b/dbutils.c @@ -1672,7 +1672,12 @@ identify_system(PGconn *repl_conn, t_system_identification *identification) return false; } +#if defined(__i386__) || defined(__i386) + identification->system_identifier = atoll(PQgetvalue(res, 0, 0)); +#else identification->system_identifier = atol(PQgetvalue(res, 0, 0)); +#endif + identification->timeline = atoi(PQgetvalue(res, 0, 1)); identification->xlogpos = parse_lsn(PQgetvalue(res, 0, 2)); @@ -1709,7 +1714,11 @@ system_identifier(PGconn *conn) } else { +#if defined(__i386__) || defined(__i386) + system_identifier = atoll(PQgetvalue(res, 0, 0)); +#else system_identifier = atol(PQgetvalue(res, 0, 0)); +#endif } PQclear(res);