Author: derrell
Date: 2007-08-13 18:07:26 +0000 (Mon, 13 Aug 2007)
New Revision: 24379

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24379

Log:

- Apply patch from SATOH Fumiyasu to fix bug 4750.  smbc_telldir_ctx() was not
  returning a value useful to smbc_lseekdir_ctx().

Derrell

Modified:
   branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c


Changeset:
Modified: branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c
===================================================================
--- branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c  2007-08-13 17:46:11 UTC 
(rev 24378)
+++ branches/SAMBA_3_0_26/source/libsmb/libsmbclient.c  2007-08-13 18:07:26 UTC 
(rev 24379)
@@ -3445,8 +3445,6 @@
 smbc_telldir_ctx(SMBCCTX *context,
                  SMBCFILE *dir)
 {
-       off_t ret_val; /* Squash warnings about cast */
-
        if (!context || !context->internal ||
            !context->internal->_initialized) {
 
@@ -3469,12 +3467,16 @@
 
        }
 
+        /* See if we're already at the end. */
+        if (dir->dir_next == NULL) {
+                /* We are. */
+                return -1;
+        }
+
        /*
         * We return the pointer here as the offset
         */
-       ret_val = (off_t)(long)dir->dir_next;
-       return ret_val;
-
+        return (off_t)(long)dir->dir_next->dirent;
 }
 
 /*
@@ -3545,6 +3547,11 @@
 
        }
 
+        if (offset == -1) {     /* Seek to the end of the list */
+                dir->dir_next = NULL;
+                return 0;
+        }
+
        /* Now, run down the list and make sure that the entry is OK       */
        /* This may need to be changed if we change the format of the list */
 

Reply via email to