Skip to content

Commit

Permalink
Convert null characters to spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
khuck committed Feb 4, 2019
1 parent 2423438 commit c50ca35
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/apex/proc_read.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ std::string proc_data_reader::get_command_line(void) {
if (myfile.is_open()) {
getline (myfile,line);
myfile.close();
/* From the documentation:
* This holds the complete command line for the process, unless the
* process is a zombie. In the latter case, there is nothing in this
* file: that is, a read on this file will return 0 characters. The
* command-line arguments appear in this file as a set of null-separated
* strings, with a further null byte ('\0') after the last string. */
// so replace all the nulls with spaces
std::replace(line.begin(), line.end(), '\0', ' ');
} else {
// it wasn't there, so return nothing.
}
Expand Down

0 comments on commit c50ca35

Please sign in to comment.