Skip to contentSkip to conversation

libsemanage: genhomedircon: remove duplicated test condition

PATCH Applied Nicolas Iooss 3 participants 5 messages Jan 4, 2017 – Jan 9, 2017 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libsemanage: genhomedircon: remove duplicated test condition

---
 libsemanage/src/genhomedircon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/genhomedircon.c +1 -1
index 7ceeafb7b5d9..fd6d391984b6 100644
@@ -246,7 +246,7 @@ static int fcontext_matches(const semanage_fcontext_t *fcontext, void *varg)
 
 	/* Only match ALL or DIR */
 	type = semanage_fcontext_get_type(fcontext);
-	if (type != SEMANAGE_FCONTEXT_ALL && type != SEMANAGE_FCONTEXT_ALL)
+	if (type != SEMANAGE_FCONTEXT_ALL)
 		return 0;
 
 	len = strlen(oexpr);
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/2 libsemanage: increment the right index variable in for loop

---
 libsemanage/src/semanage_store.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/semanage_store.c +1 -1
index 58a58ef9452e..f468faba4b64 100644
@@ -1158,7 +1158,7 @@ cleanup:
 	free(all_modinfos);
 
 	if (status != 0) {
-		for (i = 0; i < j; j++) {
+		for (i = 0; i < j; i++) {
 			semanage_module_info_destroy(sh, &(*modinfo)[i]);
 		}
 		free(*modinfo);
Signature · 1 line
2.11.0
Applied
#2 lore raw

Re: [PATCH 2/2] libsemanage: increment the right index variable in for loop

Quoted 1 line · Nicolas Iooss

Applied.

Thanks,

Quoted 18 lines
---
 libsemanage/src/semanage_store.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/semanage_store.c +1 -1
index 58a58ef9452e..f468faba4b64 100644
@@ -1158,7 +1158,7 @@ cleanup:
 	free(all_modinfos);
 
 	if (status != 0) {
-		for (i = 0; i < j; j++) {
+		for (i = 0; i < j; i++) {
 			semanage_module_info_destroy(sh, &(*modinfo)[i]);
 		}
 		free(*modinfo);
Signature · 2 lines
James Carter <[email protected]>
National Security Agency
Applied
#3 lore raw
In reply to Nicolas Iooss
Quoted 1 line · Nicolas Iooss

Applied.

Thanks,

Quoted 18 lines
---
 libsemanage/src/genhomedircon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/genhomedircon.c +1 -1
index 7ceeafb7b5d9..fd6d391984b6 100644
@@ -246,7 +246,7 @@ static int fcontext_matches(const semanage_fcontext_t *fcontext, void *varg)
 
 	/* Only match ALL or DIR */
 	type = semanage_fcontext_get_type(fcontext);
-	if (type != SEMANAGE_FCONTEXT_ALL && type != SEMANAGE_FCONTEXT_ALL)
+	if (type != SEMANAGE_FCONTEXT_ALL)
 		return 0;
 
 	len = strlen(oexpr);
Signature · 2 lines
James Carter <[email protected]>
National Security Agency
#4 lore raw
In reply to Nicolas Iooss
Quoted 17 lines · Nicolas Iooss

---
 libsemanage/src/genhomedircon.c | 2 +-

 1 file changed, 1 insertion(+), 1 deletion(-)
libsemanage/src/genhomedircon.c +0 -0
index 7ceeafb7b5d9..fd6d391984b6 100644
@@ -246,7 +246,7 @@ static int fcontext_matches(const
 semanage_fcontext_t *fcontext, void *varg)


  /* Only match ALL or DIR */
  type = semanage_fcontext_get_type(fcontext);

libsemanage/src/genhomedircon.c +0 -1
-	if (type != SEMANAGE_FCONTEXT_ALL && type !=

SEMANAGE_FCONTEXT_ALL)

libsemanage/src/genhomedircon.c static int fcontext_matches(const semanage_fcontext_t *fcontext, void *varg) · line 249

Quoted 1 line
libsemanage/src/genhomedircon.c +1 -0
+	if (type != SEMANAGE_FCONTEXT_ALL)

The comment suggests the second test should be against SEMANAGE_FCONTEXT_DIR, not removed altogether.

Quoted 3 lines

  return 0;

  len = strlen(oexpr);