diff options
-rw-r--r-- | src/procattr.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/procattr.c b/src/procattr.c index a55465a..74c0012 100644 --- a/src/procattr.c +++ b/src/procattr.c @@ -139,7 +139,12 @@ static int setprocattrcon(const char * context, #define getpidattr_def(fn, attr) \ int get##fn(pid_t pid, char **c) \ { \ - return getprocattrcon(c, pid, #attr); \ + if (pid <= 0) { \ + errno = EINVAL; \ + return -1; \ + } else { \ + return getprocattrcon(c, pid, #attr); \ + } \ } all_selfattr_def(con, current) |