aboutsummaryrefslogtreecommitdiff
path: root/util-linux/switch_root.c
diff options
context:
space:
mode:
authorvda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-01 10:25:35 +0000
committervda <vda@69ca8d6d-28ef-0310-b511-8ec308f3f277>2006-11-01 10:25:35 +0000
commitf0b3fc041f40e2185a14c3b5ff778444c2b98c81 (patch)
tree99c5ad443f69860833c8ef37e142fddfedb90872 /util-linux/switch_root.c
parentab99e773ad9c0ea664fd869a1af5ce28d624f295 (diff)
downloadbusybox-w32-f0b3fc041f40e2185a14c3b5ff778444c2b98c81.tar.gz
busybox-w32-f0b3fc041f40e2185a14c3b5ff778444c2b98c81.tar.bz2
busybox-w32-f0b3fc041f40e2185a14c3b5ff778444c2b98c81.zip
mostly style fixes
git-svn-id: svn://busybox.net/trunk/busybox@16487 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-rw-r--r--util-linux/switch_root.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c
index 45290c942..4c23f69da 100644
--- a/util-linux/switch_root.c
+++ b/util-linux/switch_root.c
@@ -35,7 +35,7 @@ static void delete_contents(char *directory)
35 struct stat st; 35 struct stat st;
36 36
37 // Don't descend into other filesystems 37 // Don't descend into other filesystems
38 if (lstat(directory,&st) || st.st_dev != rootdev) return; 38 if (lstat(directory, &st) || st.st_dev != rootdev) return;
39 39
40 // Recursively delete the contents of directories. 40 // Recursively delete the contents of directories.
41 if (S_ISDIR(st.st_mode)) { 41 if (S_ISDIR(st.st_mode)) {
@@ -71,8 +71,8 @@ int switch_root_main(int argc, char *argv[])
71 71
72 // Parse args (-c console) 72 // Parse args (-c console)
73 73
74 opt_complementary="-2"; 74 opt_complementary = "-2";
75 getopt32(argc,argv,"c:",&console); 75 getopt32(argc, argv, "c:", &console);
76 76
77 // Change to new root directory and verify it's a different fs. 77 // Change to new root directory and verify it's a different fs.
78 78
@@ -81,7 +81,7 @@ int switch_root_main(int argc, char *argv[])
81 if (chdir(newroot) || lstat(".", &st1) || lstat("/", &st2) || 81 if (chdir(newroot) || lstat(".", &st1) || lstat("/", &st2) ||
82 st1.st_dev == st2.st_dev) 82 st1.st_dev == st2.st_dev)
83 { 83 {
84 bb_error_msg_and_die("bad newroot %s",newroot); 84 bb_error_msg_and_die("bad newroot %s", newroot);
85 } 85 }
86 rootdev=st2.st_dev; 86 rootdev=st2.st_dev;
87 87
@@ -111,12 +111,12 @@ int switch_root_main(int argc, char *argv[])
111 if (console) { 111 if (console) {
112 close(0); 112 close(0);
113 if(open(console, O_RDWR) < 0) 113 if(open(console, O_RDWR) < 0)
114 bb_error_msg_and_die("bad console '%s'",console); 114 bb_error_msg_and_die("bad console '%s'", console);
115 dup2(0, 1); 115 dup2(0, 1);
116 dup2(0, 2); 116 dup2(0, 2);
117 } 117 }
118 118
119 // Exec real init. (This is why we must be pid 1.) 119 // Exec real init. (This is why we must be pid 1.)
120 execv(argv[optind],argv+optind); 120 execv(argv[optind], argv+optind);
121 bb_error_msg_and_die("bad init '%s'",argv[optind]); 121 bb_error_msg_and_die("bad init '%s'", argv[optind]);
122} 122}