diff options
-rw-r--r-- | source3/smbd/statcache.c | 16 |
1 files changed, 9 insertions, 7 deletions
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 */ |