summaryrefslogtreecommitdiff
path: root/dmake
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-06-12 05:08:51 +0000
committerOliver Bolte <obo@openoffice.org>2007-06-12 05:08:51 +0000
commitb17b110bb681358920e946960a567bdac299e4ee (patch)
tree3efc95723cc7ed815a775edcdee6c7e65ea2cbba /dmake
parent77a621b36800c61942f32bf68e78946bf243258b (diff)
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.
Diffstat (limited to 'dmake')
-rw-r--r--dmake/unix/dcache.c35
1 files changed, 27 insertions, 8 deletions
diff --git a/dmake/unix/dcache.c b/dmake/unix/dcache.c
index c03dfd5d144b..169d037303c3 100644
--- a/dmake/unix/dcache.c
+++ b/dmake/unix/dcache.c
@@ -1,6 +1,6 @@
/* $RCSfile: dcache.c,v $
--- $Revision: 1.6 $
--- last change: $Author: vg $ $Date: 2007-01-18 09:43:52 $
+-- $Revision: 1.7 $
+-- last change: $Author: obo $ $Date: 2007-06-12 06:08:51 $
--
-- SYNOPSIS
-- Directory cache management routines.
@@ -98,6 +98,7 @@ int force;
char *spath;
char *comp;
char *dir;
+ char *udir; /* Hold the unchanged (DcacheRespCase) directory. */
int loaded=FALSE;
if (If_root_path(path))
@@ -107,13 +108,17 @@ int force;
fpath = DmStrDup(spath);
- /* do caching and comparing lower case if told so. */
- if( !STOBOOL(DcacheRespCase) )
- strlwr(fpath);
-
- comp = Basename(fpath);
+ comp = Basename(fpath); /* Use before the Filedir() call. */
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);
for(dp=dtab[hv]; dp; dp=dp->next)
@@ -137,7 +142,18 @@ int force;
dp->path = DmStrDup(dir);
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)) {
while((direntp=readdir(dirp)) != NULL) {
TALLOC(ep,1,Entry);
@@ -199,6 +215,9 @@ int force;
Pname, spath, ep ? ep->mtime : 0L);
}
+ if( udir != dir )
+ FREE(udir); /* Keep this before the free of fpath. */
+
FREE(fpath);
return(!ep ? (time_t)0L : ((STOBOOL(Augmake) && ep->isdir)?0L:ep->mtime));
}