diff options
author | Jeremy Allison <jra@samba.org> | 2010-07-13 09:30:35 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2010-07-13 09:30:35 -0700 |
commit | 5bdb8b472ce9c8072d4ffade4075f9ec17ae3819 (patch) | |
tree | 7c4830f8ea44048f9228d59c8ed7129c218f36e0 /source3/smbd/vfs.c | |
parent | 53e1586e2a2c32ad57524343de81f9cff5882b48 (diff) | |
download | samba-5bdb8b472ce9c8072d4ffade4075f9ec17ae3819.tar.gz samba-5bdb8b472ce9c8072d4ffade4075f9ec17ae3819.tar.bz2 samba-5bdb8b472ce9c8072d4ffade4075f9ec17ae3819.zip |
Revert "Remove the global char *LastDir."
Volker pointed out I'd missed the "last directory" cache
part of this code. Return us to caching the directory we're
in (reduces sys call load).
Mea maxima culpa.
Jeremy.
This reverts commit 2f30aea3324f32f9b8555e961256fc1280da2871.
Diffstat (limited to 'source3/smbd/vfs.c')
-rw-r--r-- | source3/smbd/vfs.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 7df51cff95..d4e9f02a69 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -707,7 +707,26 @@ const char *vfs_readdirname(connection_struct *conn, void *p, int vfs_ChDir(connection_struct *conn, const char *path) { - return SMB_VFS_CHDIR(conn,path); + int res; + + if (!LastDir) { + LastDir = SMB_STRDUP(""); + } + + if (strcsequal(path,".")) + return(0); + + if (*path == '/' && strcsequal(LastDir,path)) + return(0); + + DEBUG(4,("vfs_ChDir to %s\n",path)); + + res = SMB_VFS_CHDIR(conn,path); + if (!res) { + SAFE_FREE(LastDir); + LastDir = SMB_STRDUP(path); + } + return(res); } /******************************************************************* |