Skip to contentSkip to conversation

libselinux: set an appropriate errno in booleans.c

PATCH In review Petr Lautrbach 2 participants 6 messages Jan 31, 2019 – Feb 5, 2019 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libselinux: set an appropriate errno in booleans.c

Fixes:

$ mkdir booleans
$ sudo mount --bind ./booleans /sys/fs/selinux/booleans
$ sudo getsebool -a
getsebool:  Unable to get boolean names:  Success
---
 libselinux/src/booleans.c | 1 +
 1 file changed, 1 insertion(+)
libselinux/src/booleans.c +1 -0
index b3ea3623..a6d46fea 100644
@@ -55,6 +55,7 @@ int security_get_boolean_names(char ***names, int *len)
 	snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
 	*len = scandir(path, &namelist, &filename_select, alphasort);
 	if (*len <= 0) {
+		errno = ENOENT;
 		return -1;
 	}
 
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 libselinux: Change matchpathcon usage to match with matchpathcon manpage

---
 libselinux/utils/matchpathcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/utils/matchpathcon.c +1 -1
index 67e4a433..9756d7d9 100644
@@ -14,7 +14,7 @@
 static __attribute__ ((__noreturn__)) void usage(const char *progname)
 {
 	fprintf(stderr,
-		"usage:  %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n",
+		"usage:  %s [-V] [-N] [-n] [-m type] [-f file_contexts_file] [-p prefix] [-P policy_root_path] filepath...\n",
 		progname);
 	exit(1);
 }
Signature · 1 line
2.20.1
Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] libselinux: Change matchpathcon usage to match with matchpathcon manpage

Quoted 2 lines · Petr Lautrbach
Quoted 20 lines
---
 libselinux/utils/matchpathcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/utils/matchpathcon.c +1 -2
index 67e4a433..9756d7d9 100644
@@ -14,7 +14,7 @@
 static __attribute__ ((__noreturn__)) void usage(const char *progname)
 {
        fprintf(stderr,
-               "usage:  %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n",
+               "usage:  %s [-V] [-N] [-n] [-m type] [-f file_contexts_file] [-p prefix] [-P policy_root_path] filepath...\n",
                progname);
        exit(1);
 }
--

2.20.1

#3 lore raw

Re: [PATCH 2/2] libselinux: Change matchpathcon usage to match with matchpathcon manpage

Quoted 6 lines · Nicolas Iooss
Quoted 2 lines · Petr Lautrbach

Merged. Thanks
Nicolas

Quoted 20 lines
Quoted 20 lines
---
 libselinux/utils/matchpathcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/utils/matchpathcon.c +1 -2
index 67e4a433..9756d7d9 100644
@@ -14,7 +14,7 @@
 static __attribute__ ((__noreturn__)) void usage(const char *progname)
 {
        fprintf(stderr,
-               "usage:  %s [-N] [-n] [-f file_contexts] [ -P policy_root_path ] [-p prefix] [-Vq] path...\n",
+               "usage:  %s [-V] [-N] [-n] [-m type] [-f file_contexts_file] [-p prefix] [-P policy_root_path] filepath...\n",
                progname);
        exit(1);
 }
--

2.20.1

Acked-by on v1 1/2
#4 lore raw
In reply to Petr Lautrbach
Quoted 8 lines · Petr Lautrbach

Fixes:

$ mkdir booleans
$ sudo mount --bind ./booleans /sys/fs/selinux/booleans
$ sudo getsebool -a
getsebool:  Unable to get boolean names:  Success
Quoted 19 lines
---
 libselinux/src/booleans.c | 1 +
 1 file changed, 1 insertion(+)
libselinux/src/booleans.c +1 -1
index b3ea3623..a6d46fea 100644
@@ -55,6 +55,7 @@ int security_get_boolean_names(char ***names, int *len)
        snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
        *len = scandir(path, &namelist, &filename_select, alphasort);
        if (*len <= 0) {
+               errno = ENOENT;
                return -1;
        }
 
--

2.20.1

#5 lore raw
Quoted 9 lines · Nicolas Iooss
Quoted 7 lines · Petr Lautrbach

Fixes:

$ mkdir booleans
$ sudo mount --bind ./booleans /sys/fs/selinux/booleans
$ sudo getsebool -a
getsebool:  Unable to get boolean names:  Success
Quoted 3 lines
Quoted 1 line

Merged. Thanks
Nicolas

Quoted 19 lines
Quoted 19 lines
---
 libselinux/src/booleans.c | 1 +
 1 file changed, 1 insertion(+)
libselinux/src/booleans.c +1 -1
index b3ea3623..a6d46fea 100644
@@ -55,6 +55,7 @@ int security_get_boolean_names(char ***names, int *len)
        snprintf(path, sizeof path, "%s%s", selinux_mnt, SELINUX_BOOL_DIR);
        *len = scandir(path, &namelist, &filename_select, alphasort);
        if (*len <= 0) {
+               errno = ENOENT;
                return -1;
        }
 
--

2.20.1