-
-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix read error cmdline #151
Conversation
std::strerror(errno)); | ||
std::exit(3); | ||
return NULL; | ||
return false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 much more graceful :)
@@ -151,9 +142,21 @@ void setnode(unsigned long inode, pid_t pid) { | |||
prg_node *newnode = new prg_node; | |||
newnode->inode = inode; | |||
newnode->pid = pid; | |||
newnode->cmdline = getcmdline(pid); | |||
bool result = getcmdline(pid, newnode->cmdline); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should split this into 2 parameters (one for the program and one for the parameters) already here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay.
If the caller needs all the details, newnode->cmdline
need to be of type vector<string>
, because there may be spaces in an parameter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I'm reading this right, newnode->cmdline
is now populated with a string containing the program name, then a \0
, and then all parameters (with spaces).
That seems kind of odd. I was proposing returning 2 strings instead, one for the program name and one for the parameters (with spaces), removing the funny business with the \0
character. WDYT?
(closing due to inactivity, feel free to reopen when resuming work on this) |
This PR follows #150 .