Skip to content

Commit a54b607

Browse files
authored
Fix bvar's bad return value (#3151)
1 parent dea0570 commit a54b607

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/bvar/default_variables.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ static bool read_proc_status(ProcStat &stat) {
107107
",tpgid,flags,pri,nice | tail -n1", (long)pid);
108108
if (butil::read_command_output(oss, cmdbuf) != 0) {
109109
LOG(ERROR) << "Fail to read stat";
110-
return -1;
110+
return false;
111111
}
112112
const std::string& result = oss.str();
113113
if (sscanf(result.c_str(), "%d %d %d %d"
@@ -230,7 +230,7 @@ static bool read_proc_memory(ProcMemory &m) {
230230
snprintf(cmdbuf, sizeof(cmdbuf), "ps -p %ld -o rss=,vsz=", (long)pid);
231231
if (butil::read_command_output(oss, cmdbuf) != 0) {
232232
LOG(ERROR) << "Fail to read memory state";
233-
return -1;
233+
return false;
234234
}
235235
const std::string& result = oss.str();
236236
if (sscanf(result.c_str(), "%ld %ld", &m.resident, &m.size) != 2) {
@@ -292,7 +292,7 @@ static bool read_load_average(LoadAverage &m) {
292292
std::ostringstream oss;
293293
if (butil::read_command_output(oss, "sysctl -n vm.loadavg") != 0) {
294294
LOG(ERROR) << "Fail to read loadavg";
295-
return -1;
295+
return false;
296296
}
297297
const std::string& result = oss.str();
298298
if (sscanf(result.c_str(), "{ %lf %lf %lf }",

0 commit comments

Comments
 (0)