restorecond: close the PID file if writing to it failed
write_pid_file() leaks a file descriptor to /var/run/restorecond.pid if it fails to write the PID to it. Close the file before returning. Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
parent
f032946cf9
commit
2b0fbebd50
1 changed files with 1 additions and 0 deletions
|
@ -105,6 +105,7 @@ static int write_pid_file(void)
|
||||||
}
|
}
|
||||||
if (write(pidfd, val, (unsigned int)len) != len) {
|
if (write(pidfd, val, (unsigned int)len) != len) {
|
||||||
syslog(LOG_ERR, "Unable to write to pidfile (%s)", strerror(errno));
|
syslog(LOG_ERR, "Unable to write to pidfile (%s)", strerror(errno));
|
||||||
|
close(pidfd);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
close(pidfd);
|
close(pidfd);
|
||||||
|
|
Loading…
Reference in a new issue