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
diff --git a/cmds/lshal/libprocpartition/procpartition.cpp b/cmds/lshal/libprocpartition/procpartition.cpp
index 8ca458a..9645f3a 100644
--- a/cmds/lshal/libprocpartition/procpartition.cpp
+++ b/cmds/lshal/libprocpartition/procpartition.cpp
@@ -50,7 +50,7 @@
false /* follow symlinks */)) {
return "";
}
- return content;
+ return std::string{content.c_str()};
}
Partition parsePartition(const std::string& s) {