Pavel fixed a segfault in yes.
authorEric Andersen <andersen@codepoet.org>
Fri, 2 Jun 2000 17:51:39 +0000 (17:51 -0000)
committerEric Andersen <andersen@codepoet.org>
Fri, 2 Jun 2000 17:51:39 +0000 (17:51 -0000)
 -Erik

Changelog
coreutils/yes.c
yes.c

index 3083ae960265d301c333bb6f8da04a34639873bf..829232911793ffa63901623fcdefb02c4d9d0dcb 100644 (file)
--- a/Changelog
+++ b/Changelog
@@ -48,6 +48,7 @@
        * Fixed more and ps to have sensible terminal width defaults, thanks 
            to Pavel Roskin.
        * Fixed all fatalError() calls lacking a "\n", thanks to Pavel Roskin.
+       * Fixed a segfault in yes when no args were given -- Pavel Roskin.
        * More doc updates
 
 
index 97b6f653cd4b0df3f186f632051d9819984ad05d..1718af4bb8891d46b9a72e1e0c51d5ce8d9378eb 100644 (file)
@@ -27,7 +27,7 @@ extern int yes_main(int argc, char **argv)
 {
        int i;
 
-       if (argc >=1 && *argv[1]=='-') {
+       if (argc >= 2 && *argv[1] == '-') {
                usage("yes [OPTION]... [STRING]...\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
                                "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n"
diff --git a/yes.c b/yes.c
index 97b6f653cd4b0df3f186f632051d9819984ad05d..1718af4bb8891d46b9a72e1e0c51d5ce8d9378eb 100644 (file)
--- a/yes.c
+++ b/yes.c
@@ -27,7 +27,7 @@ extern int yes_main(int argc, char **argv)
 {
        int i;
 
-       if (argc >=1 && *argv[1]=='-') {
+       if (argc >= 2 && *argv[1] == '-') {
                usage("yes [OPTION]... [STRING]...\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
                                "\nRepeatedly outputs a line with all specified STRING(s), or `y'.\n"