summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2006-09-14 10:06:42 +0000
committerJim Meyering <jim@meyering.net>2006-09-14 10:06:42 +0000
commit32d83cf58764a4b1fad847675989c4bc9eacd8c4 (patch)
tree74a9d8b2f4ef19e6ad95a8c7aa294e1e38e517eb /src
parent33f1b50fca9dc2767b81770ed1b31b88750113a7 (diff)
downloadcoreutils-32d83cf58764a4b1fad847675989c4bc9eacd8c4.tar.xz
* src/mv.c (main): Remove unnecessary (always-true) test for 2 <= n.
Instead, since it's a little fragile, assert the condition. (target_directory_operand): Update comment to reflect latest change.
Diffstat (limited to 'src')
-rw-r--r--src/mv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mv.c b/src/mv.c
index ffc86d186..299a6acfd 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -140,9 +140,8 @@ cp_option_init (struct cp_options *x)
}
/* FILE is the last operand of this command. Return true if FILE is a
- directory. But report an error there is a problem accessing FILE,
- or if FILE does not exist but would have to refer to an existing
- directory if it referred to anything at all. */
+ directory. But report an error if there is a problem accessing FILE, other
+ than nonexistence (errno == ENOENT). */
static bool
target_directory_operand (char const *file)
@@ -447,7 +446,8 @@ main (int argc, char **argv)
}
else if (!target_directory)
{
- if (2 <= n_files && target_directory_operand (file[n_files - 1]))
+ assert (2 <= n_files);
+ if (target_directory_operand (file[n_files - 1]))
target_directory = file[--n_files];
else if (2 < n_files)
error (EXIT_FAILURE, 0, _("target %s is not a directory"),