As Larry pointed out, this the off by one canbe fixed much more elegantly.
authorEric Andersen <andersen@codepoet.org>
Thu, 26 Apr 2001 15:41:51 +0000 (15:41 -0000)
committerEric Andersen <andersen@codepoet.org>
Thu, 26 Apr 2001 15:41:51 +0000 (15:41 -0000)
chgrp.c
chmod.c
chown.c
coreutils/chgrp.c
coreutils/chmod.c
coreutils/chown.c

diff --git a/chgrp.c b/chgrp.c
index 83bb194..55e22f5 100644 (file)
--- a/chgrp.c
+++ b/chgrp.c
@@ -71,7 +71,7 @@ int chgrp_main(int argc, char **argv)
        }
 
        /* Ok, ready to do the deed now */
-       while (optind++ < argc-1) {
+       while (++optind < argc) {
                if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE, 
                                        fileAction, fileAction, NULL) == FALSE) {
                        return EXIT_FAILURE;
diff --git a/chmod.c b/chmod.c
index f22e5d0..b1d7512 100644 (file)
--- a/chmod.c
+++ b/chmod.c
@@ -66,7 +66,7 @@ int chmod_main(int argc, char **argv)
        }
 
        /* Ok, ready to do the deed now */
-       while (optind++ < argc-1) {
+       while (++optind < argc) {
                if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE, 
                                        fileAction, fileAction, NULL) == FALSE) {
                        return EXIT_FAILURE;
diff --git a/chown.c b/chown.c
index 43d62b1..e714b2d 100644 (file)
--- a/chown.c
+++ b/chown.c
@@ -85,7 +85,7 @@ int chown_main(int argc, char **argv)
        }
 
        /* Ok, ready to do the deed now */
-       while (optind++ < argc-1) {
+       while (++optind < argc) {
                if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE, 
                                        fileAction, fileAction, NULL) == FALSE) {
                        return EXIT_FAILURE;
index 83bb194..55e22f5 100644 (file)
@@ -71,7 +71,7 @@ int chgrp_main(int argc, char **argv)
        }
 
        /* Ok, ready to do the deed now */
-       while (optind++ < argc-1) {
+       while (++optind < argc) {
                if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE, 
                                        fileAction, fileAction, NULL) == FALSE) {
                        return EXIT_FAILURE;
index f22e5d0..b1d7512 100644 (file)
@@ -66,7 +66,7 @@ int chmod_main(int argc, char **argv)
        }
 
        /* Ok, ready to do the deed now */
-       while (optind++ < argc-1) {
+       while (++optind < argc) {
                if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE, 
                                        fileAction, fileAction, NULL) == FALSE) {
                        return EXIT_FAILURE;
index 43d62b1..e714b2d 100644 (file)
@@ -85,7 +85,7 @@ int chown_main(int argc, char **argv)
        }
 
        /* Ok, ready to do the deed now */
-       while (optind++ < argc-1) {
+       while (++optind < argc) {
                if (recursive_action (argv[optind], recursiveFlag, FALSE, FALSE, 
                                        fileAction, fileAction, NULL) == FALSE) {
                        return EXIT_FAILURE;