[klibc] [PATCH 2/8] switch_root: checkpatch cleanup

maximilian attems max at stro.at
Wed Jul 13 06:48:27 PDT 2011


Signed-off-by: maximilian attems <max at stro.at>
---
 usr/kinit/switch_root/switch_root.c    |    5 ++---
 usr/kinit/switch_root/switch_rootlib.c |    6 ++++--
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/usr/kinit/switch_root/switch_root.c b/usr/kinit/switch_root/switch_root.c
index dbbbd9a..a422dc0 100644
--- a/usr/kinit/switch_root/switch_root.c
+++ b/usr/kinit/switch_root/switch_root.c
@@ -71,11 +71,10 @@ int main(int argc, char *argv[])
 	program = argv[0];
 
 	while ((o = getopt(argc, argv, "c:")) != -1) {
-		if (o == 'c') {
+		if (o == 'c')
 			console = optarg;
-		} else {
+		else
 			usage();
-		}
 	}
 
 	if (argc - optind < 2)
diff --git a/usr/kinit/switch_root/switch_rootlib.c b/usr/kinit/switch_root/switch_rootlib.c
index 23ce41f..8c9599e 100644
--- a/usr/kinit/switch_root/switch_rootlib.c
+++ b/usr/kinit/switch_root/switch_rootlib.c
@@ -103,7 +103,8 @@ static int nuke_dir(const char *what)
 	if (!S_ISDIR(st.st_mode))
 		return ENOTDIR;
 
-	if (!(dir = opendir(what))) {
+	dir = opendir(what);
+	if (!dir) {
 		/* EACCES means we can't read it.  Might be empty and removable;
 		   if not, the rmdir() in nuke() will trigger an error. */
 		return (errno == EACCES) ? 0 : errno;
@@ -196,7 +197,8 @@ const char *switch_root(const char *realroot, const char *console,
 		return "chroot";
 
 	/* Open /dev/console */
-	if ((confd = open(console, O_RDWR)) < 0)
+	confd = open(console, O_RDWR);
+	if (confd < 0)
 		return "opening console";
 	dup2(confd, 0);
 	dup2(confd, 1);
-- 
1.7.5.4



More information about the klibc mailing list