mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-04-26 03:20:40 +00:00
Use mkdtempat instead of mkdtemp
This fixes an interaction of -C with incremental 'X'. Problem reported by Pavel Cahyna. * gnulib.modules: Remove mkdtemp. Add tempname, since our mkdtempat uses it. * lib/mkdtempat.c, lib/mkdtempat.h: New files. * lib/Makefile.am (noinst_HEADERS): Add mkdtempat.h. (libtar_a_SOURCES): Add mkdtempat.c. * src/incremen.c: Include mkdtempat.h. (purge_directory): Use mkdtempat, not mkdtemp.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
#include <c-ctype.h>
|
||||
#include <flexmember.h>
|
||||
#include <hash.h>
|
||||
#include <mkdtempat.h>
|
||||
#include <quotearg.h>
|
||||
#include <same-inode.h>
|
||||
#include "common.h"
|
||||
@@ -1665,7 +1666,9 @@ purge_directory (char const *directory_name)
|
||||
*copy_end = '/';
|
||||
memcpy (copy_end + !ISSLASH (copy_end[-1]), TEMP_DIR_TEMPLATE,
|
||||
sizeof TEMP_DIR_TEMPLATE);
|
||||
if (!mkdtemp (temp_stub))
|
||||
struct fdbase f = fdbase (temp_stub);
|
||||
if (f.fd == BADFD
|
||||
|| !mkdtempat (f.fd, temp_stub + (f.base - temp_stub)))
|
||||
{
|
||||
paxerror (errno, _("Cannot create temporary directory using template %s"),
|
||||
quote (temp_stub));
|
||||
|
||||
Reference in New Issue
Block a user