Re: [systemd-devel] [PATCH 1/2] selinux: make sure selinux is using on mac_selinux_fix()

2014-10-24 Thread WaLyong Cho
On 10/24/2014 07:16 PM, Lennart Poettering wrote:
> On Fri, 24.10.14 13:51, WaLyong Cho (walyong@gmail.com) wrote:
> 
>> ---
>>  src/shared/selinux-util.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c
>> index 1eddd17..bb27328 100644
>> --- a/src/shared/selinux-util.c
>> +++ b/src/shared/selinux-util.c
>> @@ -128,6 +128,9 @@ int mac_selinux_fix(const char *path, bool 
>> ignore_enoent, bool ignore_erofs) {
>>  
>>  assert(path);
>>  
>> +if (!mac_selinux_use())
>> +return 0;
>> +
>>  /* if mac_selinux_init() wasn't called before we are a NOOP */
>>  if (!label_hnd)
>>  return 0;
> 
> "label_hnd" is initialized by mac_selinux_init(), which in turn checks
> for mac_selinux_use(), hence checking it here againis unnecessary.
> 
Ah, sorry, you're right.
The second patch just enough.

Thanks,

WaLyong

> 
> Lennart
> 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [PATCH 1/2] selinux: make sure selinux is using on mac_selinux_fix()

2014-10-24 Thread Lennart Poettering
On Fri, 24.10.14 13:51, WaLyong Cho (walyong@gmail.com) wrote:

> ---
>  src/shared/selinux-util.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/shared/selinux-util.c b/src/shared/selinux-util.c
> index 1eddd17..bb27328 100644
> --- a/src/shared/selinux-util.c
> +++ b/src/shared/selinux-util.c
> @@ -128,6 +128,9 @@ int mac_selinux_fix(const char *path, bool ignore_enoent, 
> bool ignore_erofs) {
>  
>  assert(path);
>  
> +if (!mac_selinux_use())
> +return 0;
> +
>  /* if mac_selinux_init() wasn't called before we are a NOOP */
>  if (!label_hnd)
>  return 0;

"label_hnd" is initialized by mac_selinux_init(), which in turn checks
for mac_selinux_use(), hence checking it here againis unnecessary.


Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel