pidfile test: guarantee nul termination of the read pid string
PR: 258701 Based on the submission by: sigsys@gmail.com MFC after: 1 week
This commit is contained in:
parent
d7cf1b262f
commit
364790beaf
@ -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");
|
||||
|
Loading…
Reference in New Issue
Block a user