aboutsummaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-09-24 03:12:20 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-09-24 16:52:41 +0000
commit364790beafec707ca3e334683e4030684d829be2 (patch)
tree298d6a84974ea1bb6febded3d252a51f3b4e05b9 /lib/libutil
parentd7cf1b262f9ff5e799446f0cbbd007905ab4ae24 (diff)
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/tests/pidfile_test.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libutil/tests/pidfile_test.c b/lib/libutil/tests/pidfile_test.c
index 9e516c35273c..9bfa6754ce54 100644
--- a/lib/libutil/tests/pidfile_test.c
+++ b/lib/libutil/tests/pidfile_test.c
@@ -286,7 +286,8 @@ test_pidfile_relative(void)
fd = open(path, O_RDONLY);
if (fd < 0)
return (strerror(errno));
- if (read(fd, pid, sizeof(pid)) < 0)
+ memset(pid, 0, sizeof(pid));
+ if (read(fd, pid, sizeof(pid) - 1) < 0)
return (strerror(errno));
if (atoi(pid) != getpid())
return ("pid mismatch");