mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
use pwrite to always write at the begining of the file.. If multiple calls
to pidfile_write happen, the pidfile will have nul characters prepended due to the cached file descriptor offset... Reviewed by: scottl MFC after: 3 days
This commit is contained in:
parent
6070eb3f93
commit
4d5e876be3
1 changed files with 1 additions and 1 deletions
|
|
@ -175,7 +175,7 @@ pidfile_write(struct pidfh *pfh)
|
|||
}
|
||||
|
||||
snprintf(pidstr, sizeof(pidstr), "%u", getpid());
|
||||
if (write(fd, pidstr, strlen(pidstr)) != (ssize_t)strlen(pidstr)) {
|
||||
if (pwrite(fd, pidstr, strlen(pidstr), 0) != (ssize_t)strlen(pidstr)) {
|
||||
error = errno;
|
||||
_pidfile_remove(pfh, 0);
|
||||
errno = error;
|
||||
|
|
|
|||
Loading…
Reference in a new issue