From 28096ad5cfebddc9a84eb6024fb16edf42c829d5 Mon Sep 17 00:00:00 2001 From: Danny Auble <da@llnl.gov> Date: Thu, 10 Dec 2009 17:01:59 +0000 Subject: [PATCH] Type cast a negative uint64_t to int64_t to avoid confusion when doing arithmetic with it in accounting dealing with over commit time. --- NEWS | 2 ++ src/plugins/accounting_storage/mysql/mysql_rollup.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index e5af5c2cf3e..500ed9dee13 100644 --- a/NEWS +++ b/NEWS @@ -22,6 +22,8 @@ documents those changes that are of interest to users and admins. line. Previously the line could be shortened prematurely. -- BLUEGENE - Fix to make sure we don't erroneously set a connection type to SMALL. + -- Type cast a negative uint64_t to int64_t to avoid confusion when doing + arithmetic with it in accounting dealing with over commit time. * Changes in SLURM 2.0.8 ======================== diff --git a/src/plugins/accounting_storage/mysql/mysql_rollup.c b/src/plugins/accounting_storage/mysql/mysql_rollup.c index eadc0e1a348..ff3654b68f2 100644 --- a/src/plugins/accounting_storage/mysql/mysql_rollup.c +++ b/src/plugins/accounting_storage/mysql/mysql_rollup.c @@ -804,8 +804,8 @@ extern int mysql_hourly_rollup(mysql_conn_t *mysql_conn, if((int64_t)c_usage->i_cpu < 0) { /* info("got %d %d %d", c_usage->r_cpu, */ /* c_usage->i_cpu, c_usage->o_cpu); */ - c_usage->r_cpu += c_usage->i_cpu; - c_usage->o_cpu -= c_usage->i_cpu; + c_usage->r_cpu += (int64_t)c_usage->i_cpu; + c_usage->o_cpu -= (int64_t)c_usage->i_cpu; c_usage->i_cpu = 0; if((int64_t)c_usage->r_cpu < 0) c_usage->r_cpu = 0; -- GitLab