Skip to content

Commit

Permalink
Changes error handling for the pid shortcut case only
Browse files Browse the repository at this point in the history
  • Loading branch information
jduck committed May 14, 2013
1 parent b0a01ce commit 6f3d51c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
support searching by real/effective/saved/fs uid/gid specifically
ignore our own process by default? maybe allow showing it
print better error messages when things fail

9 changes: 5 additions & 4 deletions privmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ main(int argc, char *argv[])
if (get_process_info(&p, optarg)) {
show_process_info(&p);
}
else {
fprintf(stderr, "[!] Unable to get privileges for process id: %s (non-existent or kernel process)\n", optarg);
return 1;
}
return 0;
}
break;
Expand Down Expand Up @@ -264,11 +268,8 @@ get_process_info(process_t *pp, const char *pidstr)
}
fclose(fp);
}
else {
/* NOTE: used to fall back on 'comm', but not anymore */
fprintf(stderr, "[!] Unable to open /proc/%s/cmdline!\n", pidstr);
else
return 0;
}

/* processes without a cmdline are probably kernel process..
* their user/groups will always be root
Expand Down

0 comments on commit 6f3d51c

Please sign in to comment.