diff options
author | Jim Meyering <jim@meyering.net> | 1999-10-17 07:39:20 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1999-10-17 07:39:20 +0000 |
commit | a374a307c500f2669166a753136c242ef5674f59 (patch) | |
tree | 47fe07cac44d026d239ee71f4a4589a5ec3a8d75 /src | |
parent | b221905959bed78f8c7f3a4dcba5ba4ea23b6dde (diff) | |
download | coreutils-a374a307c500f2669166a753136c242ef5674f59.tar.xz |
don't compute isdir() of -- or an option string
Diffstat (limited to 'src')
-rw-r--r-- | src/mv.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -438,10 +438,14 @@ main (int argc, char **argv) file = argv + optind; target_directory_specified = (target_directory != NULL); - if (!target_directory) - target_directory = file[n_files - 1]; + if (target_directory == NULL) + { + /* Be careful below. When n_files is 0, this value will be + argv[0], `--', or an option string. */ + target_directory = file[n_files - 1]; + } - dest_is_dir = isdir (target_directory); + dest_is_dir = (n_files > 0 && isdir (target_directory)); if (target_directory_specified) { |