From: Jim Meyering Date: Sat, 10 May 2003 13:25:41 +0000 (+0000) Subject: (main): Test for `missing argument' before computing n_files. X-Git-Tag: COREUTILS-5_0_1~557 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3de521ebf928574ee11e96cf1b9e57d31727c871;p=platform%2Fupstream%2Fcoreutils.git (main): Test for `missing argument' before computing n_files. --- diff --git a/src/ln.c b/src/ln.c index ef10cac..ea1d383 100644 --- a/src/ln.c +++ b/src/ln.c @@ -482,15 +482,15 @@ main (int argc, char **argv) } } - n_files = argc - optind; - file = argv + optind; - - if (n_files == 0) + if (argc <= optind) { error (0, 0, _("missing file argument")); usage (EXIT_FAILURE); } + n_files = argc - optind; + file = argv + optind; + target_directory_specified = (target_directory != NULL); if (!target_directory) target_directory = file[n_files - 1];