Re: smbfs seek support
- From: "Andrew V. Samoilov" <sav bcs zp ua>
- To: Pavel Roskin <proski gnu org>
- Cc: olecom <z ya by>, mc-devel gnome org
- Subject: Re: smbfs seek support
- Date: Fri, 27 Dec 2002 09:55:45 +0200
Hello Pavel and Olecom!
Pavel Roskin wrote:
Hello!
May I present me as little coding animal.
:-)
It's very useful patch for smbfs users. It's very little - but
powerful against windoze smb-kik programs.
Olecom, can you test backported version of this function?
--
Regards,
Andrew V. Samoilov
ChangeLog:
* smbfs.c (smbfs_lseek): Backport from Samba 2.2 Suite.
diff -u mc/vfs/smbfs.c~ mc/vfs/smbfs.c~
--- mc/vfs/smbfs.c~ Fri Sep 13 07:29:35 2002
+++ mc/vfs/smbfs.c Tue Sep 24 11:26:55 2002
@@ -1550,9 +1567,34 @@ smbfs_stat (vfs *me, char *path, struct
static int
smbfs_lseek (void *data, off_t offset, int whence)
{
- DEBUG(3, ("smbfs_lseek()\n"));
- my_errno = EOPNOTSUPP;
- return -1;
+ smbfs_handle *info = (smbfs_handle *) data;
+ size_t size;
+
+ DEBUG (3,
+ ("smbfs_lseek(info->nread => %d, offset => %d, whence => %d) \n",
+ (int) info->nread, (int) offset, whence));
+
+ switch (whence) {
+ case SEEK_SET:
+ info->nread = offset;
+ break;
+ case SEEK_CUR:
+ info->nread += offset;
+ break;
+ case SEEK_END:
+ if (!cli_qfileinfo (info->cli, info->fnum,
+ NULL, &size, NULL, NULL, NULL,
+ NULL, NULL) &&
+ !cli_getattrE (info->cli, info->fnum,
+ NULL, &size, NULL, NULL, NULL)) {
+ errno = EINVAL;
+ return -1;
+ }
+ info->nread = size + offset;
+ break;
+ }
+
+ return info->nread;
}
static int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]