From 684154694394c35b594ca101b15796898888ebde Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Fri, 14 Jan 2005 13:04:07 +0000 Subject: [PATCH] Fix restore -C to handle correctly directories containing a file with the same name (bug in the new hashdir code). --- CHANGES | 9 ++++++++- restore/symtab.c | 14 ++++++++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index f56eb80..cdeb396 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ -$Id: CHANGES,v 1.266 2005/01/14 13:01:32 stelian Exp $ +$Id: CHANGES,v 1.267 2005/01/14 13:04:07 stelian Exp $ Changes between versions 0.4b38 and 0.4b39 (released ???????????????) ===================================================================== @@ -17,6 +17,13 @@ Changes between versions 0.4b38 and 0.4b39 (released ???????????????) 3. Silenced the failure to call fgetflags() when comparing an entry which has no ext2 attributes (as in lsattr()). +4. Fix a brown paper bug in restore -C which broke restore and + caused modifications on the filesystem being compared + (directories containing a file with the same name as the + directory get renamed to RSTTMP...). Thanks to Kenneth Porter + for finding the bug and helping me + reproduce it. + Changes between versions 0.4b37 and 0.4b38 (released January 7, 2005) ===================================================================== diff --git a/restore/symtab.c b/restore/symtab.c index 8cd384c..4a2e1ab 100644 --- a/restore/symtab.c +++ b/restore/symtab.c @@ -37,7 +37,7 @@ #ifndef lint static const char rcsid[] = - "$Id: symtab.c,v 1.23 2004/12/14 14:07:58 stelian Exp $"; + "$Id: symtab.c,v 1.24 2005/01/14 13:04:07 stelian Exp $"; #endif /* not lint */ /* @@ -189,9 +189,16 @@ lookupname(char *name) char *np, *cp; char buf[MAXPATHLEN]; + ep = lookupino(ROOTINO); + cp = name; + if (*cp == '.') + ++cp; + if (*cp == '/') + ++cp; + if (*cp == '\0') + return ep; - ep = lookupino(ROOTINO); while (ep != NULL) { for (np = buf; *cp != '/' && *cp != '\0' && np < &buf[sizeof(buf)]; ) @@ -202,8 +209,7 @@ lookupname(char *name) oldep = ep; - if (strcmp(ep->e_name, buf) != 0 && - ep->e_entries != NULL) { + if (ep->e_entries != NULL) { ep = ep->e_entries[dir_hash(buf)]; for ( ; ep != NULL; ep = ep->e_sibling) -- 2.39.2