Re: [PATCH 2/2] Catch failures to set selinux contexts so it doesn't cause a crash.

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

 



On 12/15/2009 01:28 PM, David Lehman wrote:
> ---
>  isys/isys.py |    8 ++++++--
>  1 files changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/isys/isys.py b/isys/isys.py
> index 14d2a5d..9341c6b 100755
> --- a/isys/isys.py
> +++ b/isys/isys.py
> @@ -612,9 +612,13 @@ def matchPathContext(fn):
>  # @param instroot An optional root filesystem to look under for fn.
>  def setFileContext(fn, con, instroot = '/'):
>      full_path = os.path.normpath("%s/%s" % (instroot, fn))
> +    rc = False
>      if con is not None and os.access(full_path, os.F_OK):
> -        return (selinux.lsetfilecon(full_path, con) != 0)
> -    return False
> +        try:
> +            rc = (selinux.lsetfilecon(full_path, con) == 0)
> +        except OSError:
> +            log.info("failed to set SELinux context for %s" % full_path)
> +    return rc
>  
>  ## Restore the SELinux file context of a file to its default.
>  # @param fn The filename to fix.

Same comment on the error message as previous patch.  I also think we
should avoid calling this on empty mountpoints...

Basically, I think if this error shows up in the log, it's indicative of
a bug, though not necessarily one we *really* care about.

-- 
        Peter

When privacy is outlawed only outlaws will have privacy.
		-- Zimmermann

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux