summaryrefslogtreecommitdiff
path: root/source3/smbwrapper/smbw.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/smbwrapper/smbw.c')
-rw-r--r--source3/smbwrapper/smbw.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c
index 799a7f02cc..11d680befa 100644
--- a/source3/smbwrapper/smbw.c
+++ b/source3/smbwrapper/smbw.c
@@ -47,6 +47,7 @@ struct smbw_dir {
int offset, count, malloced;
struct smbw_server *srv;
struct file_info *list;
+ char *path;
};
static struct smbw_file *smbw_files;
@@ -546,6 +547,7 @@ static void free_dir(struct smbw_dir *dir)
if (dir->list) {
free(dir->list);
}
+ if (dir->path) free(dir->path);
ZERO_STRUCTP(dir);
free(dir);
}
@@ -602,6 +604,7 @@ int smbw_dir_open(const char *fname, int flags)
struct smbw_dir *dir=NULL;
pstring mask;
int fd;
+ char *s;
DEBUG(4,("%s\n", __FUNCTION__));
@@ -613,7 +616,7 @@ int smbw_dir_open(const char *fname, int flags)
smbw_init();
/* work out what server they are after */
- smbw_parse_path(fname, server, share, path);
+ s = smbw_parse_path(fname, server, share, path);
DEBUG(4,("dir_open share=%s\n", share));
@@ -665,6 +668,7 @@ int smbw_dir_open(const char *fname, int flags)
dir->fd = fd + SMBW_FD_OFFSET;
dir->srv = srv;
+ dir->path = strdup(s);
DEBUG(4,(" -> %d\n", dir->count));
@@ -987,7 +991,7 @@ int smbw_dir_close(int fd)
bitmap_clear(file_bmap, dir->fd - SMBW_FD_OFFSET);
DLIST_REMOVE(smbw_dirs, dir);
-
+
free_dir(dir);
return 0;
@@ -1634,3 +1638,26 @@ char *smbw_getcwd(char *buf, size_t size)
smbw_busy--;
return buf;
}
+
+/*****************************************************
+a wrapper for fchdir()
+*******************************************************/
+int smbw_fchdir(unsigned int fd)
+{
+ struct smbw_dir *dir;
+
+ DEBUG(4,("%s\n", __FUNCTION__));
+
+ smbw_busy++;
+
+ dir = smbw_dir(fd);
+ if (!dir) {
+ errno = EBADF;
+ smbw_busy--;
+ return -1;
+ }
+
+ smbw_busy--;
+
+ return chdir(dir->path);
+}