Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1338ccce authored by Yifan Hong's avatar Yifan Hong
Browse files

lshal: strip ending \0 from cmdline

/proc/{pid}/cmdline contains trailing null characters,
and `lshal -m` prints them. These trailing null characters
are visible when the output is redirected to an output file
or to `less`. It also make the output less "greppable" because
grep thinks the output is in binary format.

Test: adb shell lshal -m | less
Test: adb shell lshal -m | grep system_server
Change-Id: I622cba887604e5f578daa7cedddd9cdfeb304069
parent 79babbde
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ std::string getCmdline(pid_t pid) {
                                         false /* follow symlinks */)) {
                                         false /* follow symlinks */)) {
        return "";
        return "";
    }
    }
    return content;
    return std::string{content.c_str()};
}
}


Partition parsePartition(const std::string& s) {
Partition parsePartition(const std::string& s) {