From: William Roberts <bill.c.roberts@gmail.com>
To: Nicolas Iooss <nicolas.iooss@m4x.org>
Cc: selinux <selinux@tycho.nsa.gov>
Subject: Re: [PATCH 1/1] restorecond: close the PID file if writing to it failed
Date: Sun, 1 Jul 2018 13:52:08 -0700 [thread overview]
Message-ID: <CAFftDdrpbbtd0QV9pRen9c2K96WcVLCF9FtqyubLnR0bTNhqNg@mail.gmail.com> (raw)
In-Reply-To: <20180701145900.1481-1-nicolas.iooss@m4x.org>
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
prev parent reply other threads:[~2018-07-01 20:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFftDdrpbbtd0QV9pRen9c2K96WcVLCF9FtqyubLnR0bTNhqNg@mail.gmail.com \
--to=bill.c.roberts@gmail.com \
--cc=nicolas.iooss@m4x.org \
--cc=selinux@tycho.nsa.gov \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.