bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FYI: mv.c: tiny change


From: Jim Meyering
Subject: FYI: mv.c: tiny change
Date: Thu, 14 Sep 2006 12:07:33 +0200

2006-09-14  Jim Meyering  <address@hidden>

        * 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.

Index: src/mv.c
===================================================================
RCS file: /fetish/cu/src/mv.c,v
retrieving revision 1.176
diff -u -r1.176 mv.c
--- src/mv.c    8 Sep 2006 17:08:53 -0000       1.176
+++ src/mv.c    13 Sep 2006 09:24:37 -0000
@@ -140,9 +140,8 @@
 }

 /* 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 @@
     }
   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"),




reply via email to

[Prev in Thread] Current Thread [Next in Thread]