summaryrefslogtreecommitdiff
path: root/source3/smbd/statcache.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-07-07 20:22:35 +0000
committerJeremy Allison <jra@samba.org>2003-07-07 20:22:35 +0000
commit45ac30db09332bc5de20ea15cc07c25ebc6fb6f7 (patch)
tree55ffdf2f8142451fe7d6e596fae0212ebde47b9f /source3/smbd/statcache.c
parentfbc5f7e207ad5aad9812f742f38ca36c4b8d36d9 (diff)
downloadsamba-45ac30db09332bc5de20ea15cc07c25ebc6fb6f7.tar.gz
Fix from MORIYAMA Masayuki <msyk@mtg.biglobe.ne.jp> for new MB statcache
code. Bug #185. Jeremy. (This used to be commit 7a1ac7be42dfb90fd44f2c51810eedcea052386b)
Diffstat (limited to 'source3/smbd/statcache.c')
-rw-r--r--source3/smbd/statcache.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c
index 5d54a5c4ffe..22b8a33a1e2 100644
--- a/source3/smbd/statcache.c
+++ b/source3/smbd/statcache.c
@@ -270,16 +270,18 @@ BOOL stat_cache_lookup(connection_struct *conn, pstring name, pstring dirpath,
if (!sizechanged) {
memcpy(name, scp->translated_path, MIN(sizeof(pstring)-1, scp->translated_path_length));
+ } else if (num_components == 0) {
+ pstrcpy(name, scp->translated_path);
} else {
- pstring last_component;
sp = strnrchr_m(name, '/', num_components);
- if (!sp) {
- /* Logic error. */
- smb_panic("logic error in stat_cache_lookup\n");
+ if (sp) {
+ pstring last_component;
+ pstrcpy(last_component, sp);
+ pstrcpy(name, scp->translated_path);
+ pstrcat(name, last_component);
+ } else {
+ pstrcpy(name, scp->translated_path);
}
- pstrcpy(last_component, sp);
- pstrcpy(name, scp->translated_path);
- pstrcat(name, last_component);
}
/* set pointer for 'where to start' on fixing the rest of the name */