From 2b22019e426c4bb7a5745a326c302a4e19aa5ff2 Mon Sep 17 00:00:00 2001 From: Richard Sharpe Date: Wed, 7 Mar 2001 04:39:31 +0000 Subject: Fix the definition and implementation of smbc_lseekdir ... (This used to be commit e628d80d1e0f6ec87b61baeaf64019b43bf7dac8) --- source3/libsmb/libsmbclient.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'source3/libsmb/libsmbclient.c') diff --git a/source3/libsmb/libsmbclient.c b/source3/libsmb/libsmbclient.c index 770be06fda..c181780d3a 100644 --- a/source3/libsmb/libsmbclient.c +++ b/source3/libsmb/libsmbclient.c @@ -1000,7 +1000,8 @@ off_t smbc_lseek(int fd, off_t offset, int whence) if (!fe->file) { - return smbc_lseekdir(fd, offset, whence); + errno = EINVAL; + return -1; /* Can't lseek a dir ... */ } @@ -2131,10 +2132,10 @@ struct smbc_dir_list *smbc_check_dir_ent(struct smbc_dir_list *list, * Routine to seek on a directory */ -int smbc_lseekdir(int fd, off_t offset, int whence) +int smbc_lseekdir(int fd, off_t offset) { struct smbc_file *fe; - struct smbc_dirent *dirent = (struct smbc_dirent *)whence; + struct smbc_dirent *dirent = (struct smbc_dirent *)offset; struct smbc_dir_list *list_ent = NULL; if (!smbc_initialized) { @@ -2169,10 +2170,10 @@ int smbc_lseekdir(int fd, off_t offset, int whence) /* Now, check what we were passed and see if it is OK ... */ - if (!whence) { + if (dirent == NULL) { /* Seek to the begining of the list */ - errno = EINVAL; - return -1; + fe->dir_next = fe->dir_list; + return 0; } -- cgit