mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Use funlinkat in pidfile to ensure we are removing the right file.
This commit is contained in:
parent
a489026566
commit
8a9e93bb21
1 changed files with 4 additions and 1 deletions
|
|
@ -293,8 +293,11 @@ _pidfile_remove(struct pidfh *pfh, int freeit)
|
|||
return (-1);
|
||||
}
|
||||
|
||||
if (unlinkat(pfh->pf_dirfd, pfh->pf_filename, 0) == -1)
|
||||
if (funlinkat(pfh->pf_dirfd, pfh->pf_filename, pfh->pf_fd, 0) == -1) {
|
||||
if (errno == EDEADLK)
|
||||
return (-1);
|
||||
error = errno;
|
||||
}
|
||||
if (close(pfh->pf_fd) == -1 && error == 0)
|
||||
error = errno;
|
||||
if (close(pfh->pf_dirfd) == -1 && error == 0)
|
||||
|
|
|
|||
Loading…
Reference in a new issue