selinux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libselinux: fix inconsistent indentation in selinux_check_access
@ 2023-06-18 23:45 Huaxin Lu
  2023-06-27 14:36 ` Petr Lautrbach
  0 siblings, 1 reply; 2+ messages in thread
From: Huaxin Lu @ 2023-06-18 23:45 UTC (permalink / raw)
  To: selinux; +Cc: shenyining, fangxiuning, zhujianwei7

Function selinux_check_access mixes up the TABs and spaces. Fix it
to keep the consistent coding style.

Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com>
---
 libselinux/src/checkAccess.c | 42 ++++++++++++++++++------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/libselinux/src/checkAccess.c b/libselinux/src/checkAccess.c
index 022cd6b..7f0d68f 100644
--- a/libselinux/src/checkAccess.c
+++ b/libselinux/src/checkAccess.c
@@ -41,27 +41,27 @@ int selinux_check_access(const char *scon, const char *tcon, const char *class,
 
 	(void) selinux_status_updated();
 
-       sclass = string_to_security_class(class);
-       if (sclass == 0) {
-	       rc = errno;
-	       avc_log(SELINUX_ERROR, "Unknown class %s", class);
-	       if (security_deny_unknown() == 0)
-		       return 0;
-	       errno = rc;
-	       return -1;
-       }
-
-       av = string_to_av_perm(sclass, perm);
-       if (av == 0) {
-	       rc = errno;
-	       avc_log(SELINUX_ERROR, "Unknown permission %s for class %s", perm, class);
-	       if (security_deny_unknown() == 0)
-		       return 0;
-	       errno = rc;
-	       return -1;
-       }
-
-       return avc_has_perm (scon_id, tcon_id, sclass, av, NULL, aux);
+	sclass = string_to_security_class(class);
+	if (sclass == 0) {
+		rc = errno;
+		avc_log(SELINUX_ERROR, "Unknown class %s", class);
+		if (security_deny_unknown() == 0)
+			return 0;
+		errno = rc;
+		return -1;
+	}
+
+	av = string_to_av_perm(sclass, perm);
+	if (av == 0) {
+		rc = errno;
+		avc_log(SELINUX_ERROR, "Unknown permission %s for class %s", perm, class);
+		if (security_deny_unknown() == 0)
+			return 0;
+		errno = rc;
+		return -1;
+	}
+
+	return avc_has_perm (scon_id, tcon_id, sclass, av, NULL, aux);
 }
 
 static int selinux_check_passwd_access_internal(access_vector_t requested)
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] libselinux: fix inconsistent indentation in selinux_check_access
  2023-06-18 23:45 [PATCH] libselinux: fix inconsistent indentation in selinux_check_access Huaxin Lu
@ 2023-06-27 14:36 ` Petr Lautrbach
  0 siblings, 0 replies; 2+ messages in thread
From: Petr Lautrbach @ 2023-06-27 14:36 UTC (permalink / raw)
  To: Huaxin Lu, selinux; +Cc: shenyining, fangxiuning, zhujianwei7

Huaxin Lu <luhuaxin1@huawei.com> writes:

> Function selinux_check_access mixes up the TABs and spaces. Fix it
> to keep the consistent coding style.
>
> Signed-off-by: Huaxin Lu <luhuaxin1@huawei.com>

Thanks, but I would rather avoid such "cosmetic" changes if they are not
connected to a functional change.

Petr


> ---
>  libselinux/src/checkAccess.c | 42 ++++++++++++++++++------------------
>  1 file changed, 21 insertions(+), 21 deletions(-)
>
> diff --git a/libselinux/src/checkAccess.c b/libselinux/src/checkAccess.c
> index 022cd6b..7f0d68f 100644
> --- a/libselinux/src/checkAccess.c
> +++ b/libselinux/src/checkAccess.c
> @@ -41,27 +41,27 @@ int selinux_check_access(const char *scon, const char *tcon, const char *class,
>  
>  	(void) selinux_status_updated();
>  
> -       sclass = string_to_security_class(class);
> -       if (sclass == 0) {
> -	       rc = errno;
> -	       avc_log(SELINUX_ERROR, "Unknown class %s", class);
> -	       if (security_deny_unknown() == 0)
> -		       return 0;
> -	       errno = rc;
> -	       return -1;
> -       }
> -
> -       av = string_to_av_perm(sclass, perm);
> -       if (av == 0) {
> -	       rc = errno;
> -	       avc_log(SELINUX_ERROR, "Unknown permission %s for class %s", perm, class);
> -	       if (security_deny_unknown() == 0)
> -		       return 0;
> -	       errno = rc;
> -	       return -1;
> -       }
> -
> -       return avc_has_perm (scon_id, tcon_id, sclass, av, NULL, aux);
> +	sclass = string_to_security_class(class);
> +	if (sclass == 0) {
> +		rc = errno;
> +		avc_log(SELINUX_ERROR, "Unknown class %s", class);
> +		if (security_deny_unknown() == 0)
> +			return 0;
> +		errno = rc;
> +		return -1;
> +	}
> +
> +	av = string_to_av_perm(sclass, perm);
> +	if (av == 0) {
> +		rc = errno;
> +		avc_log(SELINUX_ERROR, "Unknown permission %s for class %s", perm, class);
> +		if (security_deny_unknown() == 0)
> +			return 0;
> +		errno = rc;
> +		return -1;
> +	}
> +
> +	return avc_has_perm (scon_id, tcon_id, sclass, av, NULL, aux);
>  }
>  
>  static int selinux_check_passwd_access_internal(access_vector_t requested)
> -- 
> 2.33.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-27 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-18 23:45 [PATCH] libselinux: fix inconsistent indentation in selinux_check_access Huaxin Lu
2023-06-27 14:36 ` Petr Lautrbach

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).