X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fmisc.c;h=d263c0785da5503be29f40c02c45bd02e28372f2;hb=15c02c2b9d383446b3ea35dbea5a048e136b020d;hp=aecf4389754dc399d477d9045406aaa83b6ba4bb;hpb=a2e0cd0c0593b7084fbe47d46ddab945cd24af02;p=chaz%2Ftar diff --git a/src/misc.c b/src/misc.c index aecf438..d263c07 100644 --- a/src/misc.c +++ b/src/misc.c @@ -1,7 +1,7 @@ /* Miscellaneous functions, not really specific to GNU tar. Copyright 1988, 1992, 1994-1997, 1999-2001, 2003-2007, 2009-2010, - 2012-2013 Free Software Foundation, Inc. + 2012-2014 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 @@ -288,7 +288,8 @@ normalize_filename (int cdidx, const char *name) this following approach may lead to situations where the same file or directory is processed twice under different absolute paths without that duplication being detected. Perhaps we - should use dev+ino pairs instead of names? */ + should use dev+ino pairs instead of names? (See listed03.at for + a related test case.) */ const char *cdpath = tar_getcdpath (cdidx); size_t copylen; bool need_separator; @@ -585,7 +586,12 @@ safer_rmdir (const char *file_name) return -1; } - return unlinkat (chdir_fd, file_name, AT_REMOVEDIR); + if (unlinkat (chdir_fd, file_name, AT_REMOVEDIR) == 0) + { + remove_delayed_set_stat (file_name); + return 0; + } + return -1; } /* Remove FILE_NAME, returning 1 on success. If FILE_NAME is a directory, @@ -1239,7 +1245,7 @@ tar_savedir (const char *name, int must_exist) open_error (name); } else if (! ((dir = fdopendir (fd)) - && (ret = streamsavedir (dir)))) + && (ret = streamsavedir (dir, savedir_sort_order)))) savedir_error (name); if (dir ? closedir (dir) != 0 : 0 <= fd && close (fd) != 0)