The branch main has been updated by olce:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=e4ce30f8da612db96410b66cccf9fc12ccce282a

commit e4ce30f8da612db96410b66cccf9fc12ccce282a
Author:     Olivier Certner <o...@freebsd.org>
AuthorDate: 2024-07-04 16:35:47 +0000
Commit:     Olivier Certner <o...@freebsd.org>
CommitDate: 2024-12-16 14:42:37 +0000

    MAC/do: parse_rule_element(): Style, more clarity
    
    Add newlines to separate logical blocks.  Remove braces around 'if's
    non-compound substatements.
    
    No functional change (intended).
    
    Reviewed by:    bapt
    Approved by:    markj (mentor)
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D47611
---
 sys/security/mac_do/mac_do.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/sys/security/mac_do/mac_do.c b/sys/security/mac_do/mac_do.c
index ed1d0bcfa43c..4ef9b68bf513 100644
--- a/sys/security/mac_do/mac_do.c
+++ b/sys/security/mac_do/mac_do.c
@@ -94,19 +94,22 @@ parse_rule_element(char *element, struct rule **rule)
                error = EINVAL;
                goto error;
        }
-       if (strcmp(type, "uid") == 0) {
+
+       if (strcmp(type, "uid") == 0)
                new->from_type = RULE_UID;
-       } else if (strcmp(type, "gid") == 0) {
+       else if (strcmp(type, "gid") == 0)
                new->from_type = RULE_GID;
-       } else {
+       else {
                error = EINVAL;
                goto error;
        }
+
        id = strsep(&element, ":");
        if (id == NULL) {
                error = EINVAL;
                goto error;
        }
+
        switch (new->from_type) {
        case RULE_UID:
                new->f_uid = strtol(id, &p, 10);
@@ -121,13 +124,14 @@ parse_rule_element(char *element, struct rule **rule)
                error = EINVAL;
                goto error;
        }
+
        if (element == NULL || *element == '\0') {
                error = EINVAL;
                goto error;
        }
-       if (strcmp(element, "any") == 0 || strcmp(element, "*") == 0) {
+       if (strcmp(element, "any") == 0 || strcmp(element, "*") == 0)
                new->to_type = RULE_ANY;
-       } else {
+       else {
                new->to_type = RULE_UID;
                new->t_uid = strtol(element, &p, 10);
                if (*p != '\0') {

Reply via email to