From 0dd96e9609b18b8680b10cccac65be931f11728f Mon Sep 17 00:00:00 2001 From: Yang Zongze Date: Thu, 28 Jul 2022 14:35:24 +0800 Subject: [PATCH] Fixbug: SIGFPE error when cpu.cfs_period_us = 0 This will fix the issue (#2173). (cherry picked from commit d502d19378a40a77a8d66f55c35d8c50c99a2423) --- src/util.cc | 2 ++ src/version.cc | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util.cc b/src/util.cc index 483f4a6250..ef5f103305 100644 --- a/src/util.cc +++ b/src/util.cc @@ -647,6 +647,8 @@ int ParseCPUFromCGroup() { readCount(cpu->second + "/cpu.cfs_period_us"); if (!period.second) return -1; + if (period.first == 0) + return -1; return quota.first / period.first; } #endif diff --git a/src/version.cc b/src/version.cc index 0ab382cdba..e130b79374 100644 --- a/src/version.cc +++ b/src/version.cc @@ -20,7 +20,7 @@ using namespace std; -const char* kNinjaVersion = "1.11.0.conti.2"; +const char* kNinjaVersion = "1.11.1.conti.1"; void ParseVersion(const string& version, int* major, int* minor) { size_t end = version.find('.');