]> Dogcows Code - chaz/tar/commitdiff
(remove_any_file): Fix typo in previous change.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 17 May 2005 08:34:03 +0000 (08:34 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 17 May 2005 08:34:03 +0000 (08:34 +0000)
src/misc.c

index 95934d17c196feb24a358385e2c2a8eff9ec215a..b8b48c5d7b3a35b054d86d948d63c6fbf5f88340 100644 (file)
@@ -1,7 +1,7 @@
 /* Miscellaneous functions, not really specific to GNU tar.
 
    Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
-   2003, 2004 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -272,7 +272,9 @@ remove_any_file (const char *file_name, enum remove_option option)
   /* Try unlink first if we cannot unlink directories, as this saves
      us a system call in the common case where we're removing a
      non-directory.  */
-  if (cannot_unlink_dir ())
+  bool try_unlink_first = cannot_unlink_dir ();
+
+  if (try_unlink_first)
     {
       if (unlink (file_name) == 0)
        return 1;
@@ -290,7 +292,7 @@ remove_any_file (const char *file_name, enum remove_option option)
   switch (errno)
     {
     case ENOTDIR:
-      return cannot_unlink_dir () && unlink (file_name) == 0;
+      return !try_unlink_first && unlink (file_name) == 0;
 
     case 0:
     case EEXIST:
This page took 0.021562 seconds and 4 git commands to generate.