summaryrefslogtreecommitdiff
path: root/src/shared/audit.c
diff options
context:
space:
mode:
authorSimon Peeters <peeters.simon@gmail.com>2014-01-04 02:35:23 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2014-01-05 00:59:13 -0500
commitb68fa010f72599e6da5822feda5ae3a47a4e63d8 (patch)
tree046694049da4187b5a8bbe85d4bca92960f2fa3e /src/shared/audit.c
parent9dddaedfcc70c6dc37ba6a48d1d8e27e12c0cb2e (diff)
shared: procfs_file_alloca: handle pid==0
when pid is set to 0 use /proc/self
Diffstat (limited to 'src/shared/audit.c')
-rw-r--r--src/shared/audit.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/shared/audit.c b/src/shared/audit.c
index 9ab46408da..8038ac3c12 100644
--- a/src/shared/audit.c
+++ b/src/shared/audit.c
@@ -46,10 +46,7 @@ int audit_session_from_pid(pid_t pid, uint32_t *id) {
if (detect_container(NULL) > 0)
return -ENOTSUP;
- if (pid == 0)
- p = "/proc/self/sessionid";
- else
- p = procfs_file_alloca(pid, "sessionid");
+ p = procfs_file_alloca(pid, "sessionid");
r = read_one_line_file(p, &s);
if (r < 0)
@@ -78,10 +75,7 @@ int audit_loginuid_from_pid(pid_t pid, uid_t *uid) {
if (detect_container(NULL) > 0)
return -ENOTSUP;
- if (pid == 0)
- p = "/proc/self/loginuid";
- else
- p = procfs_file_alloca(pid, "loginuid");
+ p = procfs_file_alloca(pid, "loginuid");
r = read_one_line_file(p, &s);
if (r < 0)