Re: [PATCH 1/1] restorecond: close the PID file if writing to it failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 1, 2018 at 7:59 AM, Nicolas Iooss <nicolas.iooss@xxxxxxx> 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@xxxxxxx>
> ---
>  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@xxxxxxxxxxxxx
> To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
> To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.

ack
_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux