Browse Source

Avoid accidental creation of string temporary

stoull is for std::string, strtoull is for char *.
Davin McCall 2 years ago
parent
commit
100669052f
1 changed files with 1 additions and 1 deletions
  1. 1 1
      src/proc-service.cc

+ 1 - 1
src/proc-service.cc

@@ -560,7 +560,7 @@ bgproc_service::read_pid_file(bp_sys::exit_status *exit_status) noexcept
 
     bool valid_pid = false;
     try {
-        unsigned long long v = std::stoull(pidbuf, nullptr, 0);
+        unsigned long long v = std::strtoull(pidbuf, nullptr, 0);
         if (v <= make_unsigned_val(std::numeric_limits<pid_t>::max())) {
             pid = (pid_t) v;
             valid_pid = true;