Kaydet (Commit) b17b110b authored tarafından Oliver Bolte's avatar Oliver Bolte

INTEGRATION: CWS dmake48 (1.6.2); FILE MERGED

2007/01/21 23:21:13 vq 1.6.2.1: #i73661# Improve case insensitive directory caching on case sensitive
file systems but it is *not* recommended to to so. A comment was added
to the man page emphasizing this.
üst 77a621b3
/* $RCSfile: dcache.c,v $ /* $RCSfile: dcache.c,v $
-- $Revision: 1.6 $ -- $Revision: 1.7 $
-- last change: $Author: vg $ $Date: 2007-01-18 09:43:52 $ -- last change: $Author: obo $ $Date: 2007-06-12 06:08:51 $
-- --
-- SYNOPSIS -- SYNOPSIS
-- Directory cache management routines. -- Directory cache management routines.
...@@ -98,6 +98,7 @@ int force; ...@@ -98,6 +98,7 @@ int force;
char *spath; char *spath;
char *comp; char *comp;
char *dir; char *dir;
char *udir; /* Hold the unchanged (DcacheRespCase) directory. */
int loaded=FALSE; int loaded=FALSE;
if (If_root_path(path)) if (If_root_path(path))
...@@ -107,13 +108,17 @@ int force; ...@@ -107,13 +108,17 @@ int force;
fpath = DmStrDup(spath); fpath = DmStrDup(spath);
/* do caching and comparing lower case if told so. */ comp = Basename(fpath); /* Use before the Filedir() call. */
if( !STOBOOL(DcacheRespCase) )
strlwr(fpath);
comp = Basename(fpath);
dir = Filedir(fpath); dir = Filedir(fpath);
/* do caching and comparing lower case if told so. */
if( !STOBOOL(DcacheRespCase) ) {
udir = DmStrDup(dir);
strlwr(comp);
strlwr(dir);
} else
udir = dir;
hv = Hash(dir,&hkey); hv = Hash(dir,&hkey);
for(dp=dtab[hv]; dp; dp=dp->next) for(dp=dtab[hv]; dp; dp=dp->next)
...@@ -137,7 +142,18 @@ int force; ...@@ -137,7 +142,18 @@ int force;
dp->path = DmStrDup(dir); dp->path = DmStrDup(dir);
dp->hkey = hkey; dp->hkey = hkey;
if (Set_dir(dir) == 0) { /* We use the unchanged (not potentially lowercased because of
* DcacheRespCase) directory as this would fail on a case sensitive
* file system.
* Note: Using case insensitive directory caching on case sensitive
* file systems is a *BAD* idea. If in doubt use case sensitive
* directory caching even on case insensitive file systems as the
* worst case in this szenario is that /foo/bar/ and /foo/BAR/ are
* cached separately (with the same content) even though they are
* the same directory. This would only happen if different targets
* using different upper/lower case spellings for the same directory
* and is *never* a good idea. */
if (Set_dir(udir) == 0) {
if((dirp=opendir(".")) != NIL(DIR)) { if((dirp=opendir(".")) != NIL(DIR)) {
while((direntp=readdir(dirp)) != NULL) { while((direntp=readdir(dirp)) != NULL) {
TALLOC(ep,1,Entry); TALLOC(ep,1,Entry);
...@@ -199,6 +215,9 @@ int force; ...@@ -199,6 +215,9 @@ int force;
Pname, spath, ep ? ep->mtime : 0L); Pname, spath, ep ? ep->mtime : 0L);
} }
if( udir != dir )
FREE(udir); /* Keep this before the free of fpath. */
FREE(fpath); FREE(fpath);
return(!ep ? (time_t)0L : ((STOBOOL(Augmake) && ep->isdir)?0L:ep->mtime)); return(!ep ? (time_t)0L : ((STOBOOL(Augmake) && ep->isdir)?0L:ep->mtime));
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment