summaryrefslogtreecommitdiff
path: root/src/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2011-04-16 01:45:45 +0200
committerLennart Poettering <lennart@poettering.net>2011-04-16 02:03:34 +0200
commit8480e784f176a4911e22497e01bfbdf084342520 (patch)
tree01b02414e16afaffa87bf870d7188b4ae79073dd /src/util.c
parent9072492933eaacbcd8daed3f9baf90583dd22574 (diff)
util: modernize get_parent_of_pid() a bit
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/util.c b/src/util.c
index 75ad56fecf..39c9db72fc 100644
--- a/src/util.c
+++ b/src/util.c
@@ -456,11 +456,11 @@ int get_parent_of_pid(pid_t pid, pid_t *_ppid) {
char fn[PATH_MAX], line[LINE_MAX], *p;
long unsigned ppid;
- assert(pid >= 0);
+ assert(pid > 0);
assert(_ppid);
assert_se(snprintf(fn, sizeof(fn)-1, "/proc/%lu/stat", (unsigned long) pid) < (int) (sizeof(fn)-1));
- fn[sizeof(fn)-1] = 0;
+ char_array_0(fn);
if (!(f = fopen(fn, "r")))
return -errno;