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.
struct vfs_init_function_entry *backends = NULL;
char *sparse_buf = NULL;
struct vfs_init_function_entry *backends = NULL;
char *sparse_buf = NULL;
/* Current number of oplocks we have outstanding. */
int32_t exclusive_oplocks_open = 0;
/* Current number of oplocks we have outstanding. */
int32_t exclusive_oplocks_open = 0;
struct vfs_init_function_entry;
extern struct vfs_init_function_entry *backends;
extern char *sparse_buf;
struct vfs_init_function_entry;
extern struct vfs_init_function_entry *backends;
extern char *sparse_buf;
/* Current number of oplocks we have outstanding. */
extern int32_t exclusive_oplocks_open;
/* Current number of oplocks we have outstanding. */
extern int32_t exclusive_oplocks_open;
int vfs_ChDir(connection_struct *conn, const char *path)
{
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);
}
/*******************************************************************
}
/*******************************************************************