Skip to contentSkip to conversation

python/sepolgen: fix typo in PathChoooser name

PATCH Applied Nicolas Iooss 2 participants 5 messages Jun 3, 2018 – Jun 6, 2018 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 python/sepolgen: fix typo in PathChoooser name

---
 python/sepolgen/src/sepolgen/defaults.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
python/sepolgen/src/sepolgen/defaults.py +3 -3
index 9591063989ad..199acfafe4cf 100644
@@ -22,7 +22,7 @@ import re
 
 # Select the correct location for the development files based on a
 # path variable (optionally read from a configuration file)
-class PathChoooser(object):
+class PathChooser(object):
     def __init__(self, pathname):
         self.config = dict()
         if not os.path.exists(pathname):
@@ -68,10 +68,10 @@ def attribute_info():
     return data_dir() + "/attribute_info"
 
 def refpolicy_makefile():
-    chooser = PathChoooser("/etc/selinux/sepolgen.conf")
+    chooser = PathChooser("/etc/selinux/sepolgen.conf")
     return chooser("Makefile")
 
 def headers():
-    chooser = PathChoooser("/etc/selinux/sepolgen.conf")
+    chooser = PathChooser("/etc/selinux/sepolgen.conf")
     return chooser("include")
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/4 policycoreutils/secon: fix typo in comment

---
 policycoreutils/secon/secon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
policycoreutils/secon/secon.c +1 -1
index c29d9fb67fa5..6078139422ab 100644
@@ -309,7 +309,7 @@ static void cmd_line(int argc, char *argv[])
 		}
 	}
 
-	if (!done) {		/* defualt, if nothing specified */
+	if (!done) {		/* default, if nothing specified */
 		opts->disp_user = TRUE;
 		opts->disp_role = TRUE;
 		opts->disp_type = TRUE;
Signature · 1 line
2.17.1
#2 lore raw

PATCH 3/4 policycoreutils/secon: free scon_trans before returning

In reply to Nicolas Iooss

disp_con() leaks scon_trans if it returns early.

---
 policycoreutils/secon/secon.c | 1 +
 1 file changed, 1 insertion(+)
policycoreutils/secon/secon.c +1 -0
index 6078139422ab..477057a6896b 100644
@@ -646,6 +646,7 @@ static void disp_con(security_context_t scon_raw)
 			disp__con_val("clearance", NULL, &color);
 		if (opts->disp_mlsr)
 			disp__con_val("mls-range", NULL, &color);
+		freecon(scon_trans);
 		return;
 	}
 
Signature · 1 line
2.17.1
#3 lore raw

PATCH 4/4 policycoreutils/hll/pp: remove unused variable

In reply to Nicolas Iooss

pp's main() never set outfd to anything else than -1 so there is no point in closing it.

---
 policycoreutils/hll/pp/pp.c | 7 -------
 1 file changed, 7 deletions(-)
policycoreutils/hll/pp/pp.c +0 -7
index b97a9b34816a..98969eb2f5f3 100644
@@ -73,7 +73,6 @@ int main(int argc, char **argv)
 	const char *ofile = NULL;
 	FILE *in = NULL;
 	FILE *out = NULL;
-	int outfd = -1;
 
 	// ignore sigpipe so we can check the return code of write, and potentially
 	// return a more helpful error message
@@ -159,12 +158,6 @@ exit:
 	if (out != NULL) {
 		fclose(out);
 	}
-	if (outfd != -1) {
-		close(outfd);
-		if (rc != 0) {
-			unlink(argv[2]);
-		}
-	}
 	sepol_module_package_free(mod_pkg);
 
 	return rc;
Signature · 1 line
2.17.1
#4 lore raw

Re: [PATCH 4/4] policycoreutils/hll/pp: remove unused variable

Quoted 2 lines · Nicolas Iooss

pp's main() never set outfd to anything else than -1 so there is no point in closing it.

Thanks, applied all four patches.

Quoted 32 lines
---
 policycoreutils/hll/pp/pp.c | 7 -------
 1 file changed, 7 deletions(-)
policycoreutils/hll/pp/pp.c +0 -7
index b97a9b34816a..98969eb2f5f3 100644
@@ -73,7 +73,6 @@ int main(int argc, char **argv)
 	const char *ofile = NULL;
 	FILE *in = NULL;
 	FILE *out = NULL;
-	int outfd = -1;
 
 	// ignore sigpipe so we can check the return code of write, and potentially
 	// return a more helpful error message
@@ -159,12 +158,6 @@ exit:
 	if (out != NULL) {
 		fclose(out);
 	}
-	if (outfd != -1) {
-		close(outfd);
-		if (rc != 0) {
-			unlink(argv[2]);
-		}
-	}
 	sepol_module_package_free(mod_pkg);
 
 	return rc;