diff options
Diffstat (limited to 'src/util.cc')
-rw-r--r-- | src/util.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/util.cc b/src/util.cc index 483f4a6..eefa3f5 100644 --- a/src/util.cc +++ b/src/util.cc @@ -369,8 +369,13 @@ int ReadFile(const string& path, string* contents, string* err) { return -errno; } +#ifdef __USE_LARGEFILE64 + struct stat64 st; + if (fstat64(fileno(f), &st) < 0) { +#else struct stat st; if (fstat(fileno(f), &st) < 0) { +#endif err->assign(strerror(errno)); fclose(f); return -errno; @@ -647,6 +652,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 |