* [PATCH 1/1] restorecond: close the PID file if writing to it failed
@ 2018-07-01 14:59 Nicolas Iooss
2018-07-01 20:52 ` William Roberts
0 siblings, 1 reply; 2+ messages in thread
From: Nicolas Iooss @ 2018-07-01 14:59 UTC (permalink / raw)
To: selinux
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>
---
restorecond/restorecond.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/restorecond/restorecond.c b/restorecond/restorecond.c
index 6fbbd35dc1b3..e1d26cb9190d 100644
--- a/restorecond/restorecond.c
+++ b/restorecond/restorecond.c
@@ -105,6 +105,7 @@ static int write_pid_file(void)
}
if (write(pidfd, val, (unsigned int)len) != len) {
syslog(LOG_ERR, "Unable to write to pidfile (%s)", strerror(errno));
+ close(pidfd);
return 1;
}
close(pidfd);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] restorecond: close the PID file if writing to it failed
2018-07-01 14:59 [PATCH 1/1] restorecond: close the PID file if writing to it failed Nicolas Iooss
@ 2018-07-01 20:52 ` William Roberts
0 siblings, 0 replies; 2+ messages in thread
From: William Roberts @ 2018-07-01 20:52 UTC (permalink / raw)
To: Nicolas Iooss; +Cc: selinux
On Sun, Jul 1, 2018 at 7:59 AM, Nicolas Iooss <nicolas.iooss@m4x.org> wrote:
> 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>
> ---
> restorecond/restorecond.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/restorecond/restorecond.c b/restorecond/restorecond.c
> index 6fbbd35dc1b3..e1d26cb9190d 100644
> --- a/restorecond/restorecond.c
> +++ b/restorecond/restorecond.c
> @@ -105,6 +105,7 @@ static int write_pid_file(void)
> }
> if (write(pidfd, val, (unsigned int)len) != len) {
> syslog(LOG_ERR, "Unable to write to pidfile (%s)", strerror(errno));
> + close(pidfd);
> return 1;
> }
> close(pidfd);
> --
> 2.17.1
>
> _______________________________________________
> Selinux mailing list
> Selinux@tycho.nsa.gov
> To unsubscribe, send email to Selinux-leave@tycho.nsa.gov.
> To get help, send an email containing "help" to Selinux-request@tycho.nsa.gov.
ack
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-01 20:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-01 14:59 [PATCH 1/1] restorecond: close the PID file if writing to it failed Nicolas Iooss
2018-07-01 20:52 ` William Roberts
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.