From 9c8ffa02f4ecd6029233de9d5cdc695fc82fc6df Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Fri, 2 Jun 2000 17:51:39 +0000 Subject: [PATCH] Pavel fixed a segfault in yes. -Erik --- Changelog | 1 + coreutils/yes.c | 2 +- yes.c | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Changelog b/Changelog index 3083ae960..829232911 100644 --- 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 diff --git a/coreutils/yes.c b/coreutils/yes.c index 97b6f653c..1718af4bb 100644 --- a/coreutils/yes.c +++ b/coreutils/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" diff --git a/yes.c b/yes.c index 97b6f653c..1718af4bb 100644 --- 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" -- 2.25.1