This is an automated email from the ASF dual-hosted git repository.

wwbmmm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brpc.git


The following commit(s) were added to refs/heads/master by this push:
     new a54b6071 Fix bvar's bad return value (#3151)
a54b6071 is described below

commit a54b6071ba4336dc6a2cc9ad242836b35a26ce62
Author: Songqing Zhang <[email protected]>
AuthorDate: Mon Nov 17 12:00:36 2025 +0800

    Fix bvar's bad return value (#3151)
---
 src/bvar/default_variables.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/bvar/default_variables.cpp b/src/bvar/default_variables.cpp
index 011508aa..395d05e1 100644
--- a/src/bvar/default_variables.cpp
+++ b/src/bvar/default_variables.cpp
@@ -107,7 +107,7 @@ static bool read_proc_status(ProcStat &stat) {
             ",tpgid,flags,pri,nice | tail -n1", (long)pid);
     if (butil::read_command_output(oss, cmdbuf) != 0) {
         LOG(ERROR) << "Fail to read stat";
-        return -1;
+        return false;
     }
     const std::string& result = oss.str();
     if (sscanf(result.c_str(), "%d %d %d %d"
@@ -230,7 +230,7 @@ static bool read_proc_memory(ProcMemory &m) {
     snprintf(cmdbuf, sizeof(cmdbuf), "ps -p %ld -o rss=,vsz=", (long)pid);
     if (butil::read_command_output(oss, cmdbuf) != 0) {
         LOG(ERROR) << "Fail to read memory state";
-        return -1;
+        return false;
     }
     const std::string& result = oss.str();
     if (sscanf(result.c_str(), "%ld %ld", &m.resident, &m.size) != 2) {
@@ -292,7 +292,7 @@ static bool read_load_average(LoadAverage &m) {
     std::ostringstream oss;
     if (butil::read_command_output(oss, "sysctl -n vm.loadavg") != 0) {
         LOG(ERROR) << "Fail to read loadavg";
-        return -1;
+        return false;
     }
     const std::string& result = oss.str();
     if (sscanf(result.c_str(), "{ %lf %lf %lf }",


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to