Mercurial > minori
comparison dep/animia/src/fd/linux.cc @ 145:8e9b71970bda
linux: fix stupid bug caused by... me?
| author | Paper <mrpapersonic@gmail.com> | 
|---|---|
| date | Sun, 12 Nov 2023 18:38:38 -0500 | 
| parents | e6668085e24d | 
| children | aa4df5a84338 | 
   comparison
  equal
  deleted
  inserted
  replaced
| 144:e6668085e24d | 145:8e9b71970bda | 
|---|---|
| 115 } | 115 } | 
| 116 | 116 | 
| 117 bool LinuxFdTools::GetProcessName(pid_t pid, std::string& result) { | 117 bool LinuxFdTools::GetProcessName(pid_t pid, std::string& result) { | 
| 118 const std::string path = PROC_LOCATION "/" + std::to_string(pid) + "/comm"; | 118 const std::string path = PROC_LOCATION "/" + std::to_string(pid) + "/comm"; | 
| 119 | 119 | 
| 120 std::string result; | |
| 121 if (!util::ReadFile(path, result)) | 120 if (!util::ReadFile(path, result)) | 
| 122 return false; | 121 return false; | 
| 123 | 122 | 
| 124 result.erase(std::remove(result.begin(), result.end(), '\n'), result.end()); | 123 result.erase(std::remove(result.begin(), result.end(), '\n'), result.end()); | 
| 125 return true; | 124 return true; | 
