policycoreutils: s/int/bool/ and use null character
cover policycoreutils: s/int/bool/ and use null character
Use bool instead of int. Use null character in a string.
Kalevi Kolttonen (2):
policycoreutils: use null character in a string
policycoreutils: use bool instead of int
policycoreutils/setfiles/setfiles.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.54.0
PATCH 1/2 policycoreutils: use null character in a string
Signed-off-by Kalevi Kolttonen <[email protected]>
--- policycoreutils/setfiles/setfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/setfiles/setfiles.c +1 -1
@@ -454,7 +454,7 @@ int main(int argc, char **argv) delim = (null_terminated !=0 ) ?'\0' :'\n' ;while ((len =getdelim (&buf, &buf_len, delim, f)) >0 ) { - buf[len -1 ] =0 ; + buf[len -1 ] ='\0' ;if (!strcmp (buf,"/" )) r_opts.mass_relabel =SELINUX_RESTORECON_MASS_RELABEL ;
Signature · 1 line
2.54.0
Re: [PATCH 1/2] policycoreutils: use null character in a string
Quoted 2 lines · Kalevi Kolttonen
Signed-off-by Kalevi Kolttonen <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Quoted 21 lines
--- policycoreutils/setfiles/setfiles.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)policycoreutils/setfiles/setfiles.c +1
-2@@ -454,7 +454,7 @@ int main(int argc, char **argv) delim = (null_terminated !=0 ) ?'\0' :'\n' ;while ((len =getdelim (&buf, &buf_len, delim, f)) >0 ) { - buf[len -1 ] =0 ; + buf[len -1 ] ='\0' ;if (!strcmp (buf,"/" )) r_opts.mass_relabel =SELINUX_RESTORECON_MASS_RELABEL ; --2.54.0
PATCH 2/2 policycoreutils: use bool instead of int
In reply to Kalevi KolttonenSigned-off-by Kalevi Kolttonen <[email protected]>
--- policycoreutils/setfiles/setfiles.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
policycoreutils/setfiles/setfiles.c +4 -3
@@ -1,4 +1,5 @@#include "restore.h" +#include <stdbool.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h>
@@ -23,7 +24,7 @@ static struct restore_opts r_opts;#define SETFILES "setfiles"#define RESTORECON "restorecon" -static int iamrestorecon; +static bool iamrestorecon;/* Behavior flags determined based on setfiles vs. restorecon */ static int ctx_validate;/* Validate contexts */
@@ -181,7 +182,7 @@ int main(int argc, char **argv)* Does not follow mounts (sets SELINUX_RESTORECON_XDEV), * Validates all file contexts at init time. */ - iamrestorecon =0 ; + iamrestorecon = false; r_opts.recurse =SELINUX_RESTORECON_RECURSE ; r_opts.userealpath =0 ;/* SELINUX_RESTORECON_REALPATH */ r_opts.add_assoc =SELINUX_RESTORECON_ADD_ASSOC ;
@@ -204,7 +205,7 @@ int main(int argc, char **argv)"Executed with unrecognized name (%s), defaulting to %s behavior.\n" , base, RESTORECON); - iamrestorecon =1 ; + iamrestorecon = true; r_opts.recurse =0 ; r_opts.userealpath =SELINUX_RESTORECON_REALPATH ; r_opts.add_assoc =0 ;
Signature · 1 line
2.54.0
Re: [PATCH 2/2] policycoreutils: use bool instead of int
Quoted 2 lines · Kalevi Kolttonen
Signed-off-by Kalevi Kolttonen <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Quoted 45 lines
--- policycoreutils/setfiles/setfiles.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)policycoreutils/setfiles/setfiles.c +4
-4@@ -1,4 +1,5 @@#include "restore.h" +#include <stdbool.h> #include <stdlib.h> #include <unistd.h> #include <fcntl.h> @@ -23,7 +24,7 @@ static struct restore_opts r_opts;#define SETFILES "setfiles"#define RESTORECON "restorecon" -static int iamrestorecon; +static bool iamrestorecon;/* Behavior flags determined based on setfiles vs. restorecon */ static int ctx_validate;/* Validate contexts */ @@ -181,7 +182,7 @@ int main(int argc, char **argv)* Does not follow mounts (sets SELINUX_RESTORECON_XDEV), * Validates all file contexts at init time. */ - iamrestorecon =0 ; + iamrestorecon = false; r_opts.recurse =SELINUX_RESTORECON_RECURSE ; r_opts.userealpath =0 ;/* SELINUX_RESTORECON_REALPATH */ r_opts.add_assoc =SELINUX_RESTORECON_ADD_ASSOC ;@@ -204,7 +205,7 @@ int main(int argc, char **argv)"Executed with unrecognized name (%s), defaulting to %s behavior.\n" , base, RESTORECON); - iamrestorecon =1 ; + iamrestorecon = true; r_opts.recurse =0 ; r_opts.userealpath =SELINUX_RESTORECON_REALPATH ; r_opts.add_assoc =0 ; --2.54.0