fixed order of chroot() and parameter evaluation so that '--version'
authorEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 30 Dec 2003 17:41:49 +0000 (17:41 +0000)
committerEnrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
Tue, 30 Dec 2003 17:41:49 +0000 (17:41 +0000)
and '--help' are working as non-root also

git-svn-id: http://svn.linux-vserver.org/svn/util-vserver/trunk@525 94cd875c-1c1d-0410-91d2-eb244daf1a30

util-vserver/src/chroot-rm.c

index a4e594b..3d453cc 100644 (file)
@@ -56,12 +56,9 @@ showVersion()
 int main(int argc, char *argv[])
 {
   int          i;
-  int          res;
+  int          res = EXIT_SUCCESS;
   int          idx = 1;
 
-  Echroot(".");
-  Echdir("/");
-
   if (argc==1) {
     WRITE_MSG(2, "No files given; use '--help' for more information\n");
     return EXIT_FAILURE;
@@ -70,7 +67,9 @@ int main(int argc, char *argv[])
   if (strcmp(argv[1], "--version")==0) showVersion();
   if (strcmp(argv[1], "--")==0)        ++idx;
 
-  res = EXIT_SUCCESS;
+  Echroot(".");
+  Echdir("/");
+  
   for (i=idx; i<argc; ++i) {
     if (unlink(argv[i])==-1) {
       WRITE_STR(2, argv[i]);