read method doesn't return undef when file reading is over.
Attached diff fixes problem. (also included is fix for compilation error).
--- Filesys-SmbClient-3.0/SmbClient.xs 2005-03-04 17:22:13.000000000 +0100
+++ Filesys-SmbClient-3.0-fixed/SmbClient.xs 2005-06-09 17:55:39.000000000 +0200
@@ -188,6 +188,7 @@
#ifdef VERBOSE
fprintf(stderr, "! Filesys::SmbClient : _readdir: %d\n", fd);
#endif
+#undef readdir
dirp = (struct smbc_dirent *)context->readdir(context, fd);
if (dirp) {
XPUSHs(sv_2mortal(newSVnv(dirp->smbc_type)));
@@ -367,7 +368,7 @@
"Read %s : %s\n", buf, strerror(errno));
}
#endif
- if (returnValue<0) {RETVAL=&PL_sv_undef;}
+ if (returnValue<=0) {RETVAL=&PL_sv_undef;}
else {RETVAL=newSVpvn(buf,returnValue);}
OUTPUT:
RETVAL