From ce1cee1f19558fd84b45c72f5d86cdca8f3c5b23 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Wed, 17 Nov 2010 15:13:28 +0000
Subject: [PATCH] beginning fix for deprecated atoi which doesn't always work
 correctly on 32 bit systems

---
 src/common/macros.h                                            | 3 +++
 .../accounting_storage/mysql/as_mysql_jobacct_process.c        | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/common/macros.h b/src/common/macros.h
index 6fa9a29ebe1..8d392dc6da8 100644
--- a/src/common/macros.h
+++ b/src/common/macros.h
@@ -245,6 +245,9 @@ typedef enum {false, true} bool;
 
 #endif /* WITH_PTHREADS */
 
+#define slurm_atoul(str) strtoul(str, NULL, 10)
+#define slurm_atoull(str) strtoull(str, NULL, 10)
+
 #ifndef strong_alias
 #  if USE_ALIAS
 #    define strong_alias(name, aliasname) \
diff --git a/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c b/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c
index 4b2268947bf..d5afc6b75bf 100644
--- a/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c
+++ b/src/plugins/accounting_storage/mysql/as_mysql_jobacct_process.c
@@ -495,7 +495,7 @@ static int _cluster_get_jobs(mysql_conn_t *mysql_conn,
 		job->submit = submit;
 		job->start = atoi(row[JOB_REQ_START]);
 		job->end = atoi(row[JOB_REQ_END]);
-		job->timelimit = atoi(row[JOB_REQ_TIMELIMIT]);
+		job->timelimit = slurm_atoul(row[JOB_REQ_TIMELIMIT]);
 
 		/* since the job->end could be set later end it here */
 		if(job->end) {
-- 
GitLab