From e3ea4c5046f17d40ad4ad7301234bce96cd6a7bc Mon Sep 17 00:00:00 2001 From: Tom Lally Date: Fri, 2 Sep 2022 21:01:31 +0100 Subject: [PATCH] Clean return value if `sysconf` fails --- src/util/SystemInfo/SystemInfoLinux.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/util/SystemInfo/SystemInfoLinux.cpp b/src/util/SystemInfo/SystemInfoLinux.cpp index fca3769e..07fe9aea 100644 --- a/src/util/SystemInfo/SystemInfoLinux.cpp +++ b/src/util/SystemInfo/SystemInfoLinux.cpp @@ -8,6 +8,10 @@ uint64 QueryRamUsage() { long page_size = sysconf(_SC_PAGESIZE); + if (page_size == -1) + { + return 0; + } std::ifstream file("/proc/self/statm"); if (file)