From 45ac30db09332bc5de20ea15cc07c25ebc6fb6f7 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 7 Jul 2003 20:22:35 +0000 Subject: Fix from MORIYAMA Masayuki for new MB statcache code. Bug #185. Jeremy. (This used to be commit 7a1ac7be42dfb90fd44f2c51810eedcea052386b) --- source3/smbd/statcache.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'source3') diff --git a/source3/smbd/statcache.c b/source3/smbd/statcache.c index 5d54a5c4ff..22b8a33a1e 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 */ -- cgit