[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-tar] Bug in --listed-incremental with --one-file-system ?
From: |
Sergey Poznyakoff |
Subject: |
Re: [Bug-tar] Bug in --listed-incremental with --one-file-system ? |
Date: |
Fri, 06 Mar 2009 15:25:54 +0200 |
Hi Gordon,
Thanks for a detailed report. Please try the attached patch.
Regards,
Sergey
Index: src/names.c
===================================================================
RCS file: /cvsroot/tar/tar/src/names.c,v
retrieving revision 1.67
diff -p -u -r1.67 names.c
--- src/names.c 16 Oct 2008 11:07:20 -0000 1.67
+++ src/names.c 6 Mar 2009 13:24:01 -0000
@@ -56,8 +56,6 @@ static char *cached_no_such_gname;
static uid_t cached_no_such_uid;
static gid_t cached_no_such_gid;
-static void register_individual_file (char const *name);
-
/* Given UID, find the corresponding UNAME. */
void
uid_to_uname (uid_t uid, char **uname)
@@ -344,8 +342,6 @@ name_next_elt (int change_dirs)
{
if (unquote_option)
unquote_string (name_buffer);
- if (incremental_option)
- register_individual_file (name_buffer);
entry.type = ep->type;
entry.v.name = name_buffer;
return &entry;
@@ -947,25 +943,25 @@ is_avoided_name (char const *name)
}
-static Hash_table *individual_file_table;
-
-static void
-register_individual_file (char const *name)
-{
- struct stat st;
-
- if (deref_stat (dereference_option, name, &st) != 0)
- return; /* Will be complained about later */
- if (S_ISDIR (st.st_mode))
- return;
-
- hash_string_insert (&individual_file_table, name);
-}
bool
is_individual_file (char const *name)
{
- return hash_string_lookup (individual_file_table, name);
+ struct name_elt *elt;
+ size_t len = strlen (name);
+
+ for (elt = name_array; elt < name_array + names; elt++)
+ {
+ if (elt->type == NELT_NAME)
+ {
+ size_t elen = strlen (elt->v.name);
+ if ((elen == len && memcmp (name, elt->v.name, len) == 0)
+ || (elen < len && memcmp (name, elt->v.name, elen) == 0
+ && ISSLASH (name[elen])))
+ return true;
+ }
+ }
+ return false;
}