]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
(main): Fix argv-handling bug in my 1998-05-09 change.
authorJim Meyering <jim@meyering.net>
Mon, 1 Jun 1998 03:28:16 +0000 (03:28 +0000)
committerJim Meyering <jim@meyering.net>
Mon, 1 Jun 1998 03:28:16 +0000 (03:28 +0000)
Reported by Don Parsons.

src/install.c

index f5a3ddbca53e3a8aeb57b815753f99821529d572..78dbad76db27e3bd200ee8490260dc5fb9777846 100644 (file)
@@ -370,11 +370,18 @@ main (int argc, char **argv)
       else
        {
          int i;
-         if (!isdir (file[1]))
-           usage (1);
+         const char *dest = file[n_files - 1];
+         if (!isdir (dest))
+           {
+             error (0, 0,
+                    _("installing multiple files, but last argument (%s) \
+is not a directory"),
+                    dest);
+             usage (1);
+           }
          for (i = 0; i < n_files - 1; i++)
            {
-             errors |= install_file_in_dir (file[i], file[n_files - 1], &x);
+             errors |= install_file_in_dir (file[i], dest, &x);
            }
        }
     }