On Wed, 2005-08-03 at 06:53 -0700, Yura Pakhuchiy wrote:
> Changes by: cha0smaster
>
> Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
> In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27378/ntfsprogs
>
> Modified Files:
> ntfsmount.c
> Log Message:
> * attrib.c: refix ntfs_attr_p{read,write}
> * ntfsmount.c: code that now not really needed, but for any case
>
>
> Index: ntfsmount.c
> ===================================================================
> RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsmount.c,v
> retrieving revision 1.18
> retrieving revision 1.19
> diff -u -p -r1.18 -r1.19
> --- ntfsmount.c 1 Aug 2005 22:04:28 -0000 1.18
> +++ ntfsmount.c 3 Aug 2005 13:52:51 -0000 1.19
> @@ -398,11 +397,25 @@ static int ntfs_fuse_read(const char *or
> res = -errno;
> goto exit;
> }
> - res = ntfs_attr_pread(na, offset, size, buf);
> - if (res == -1)
> - res = -errno;
> - ntfs_attr_close(na);
> + if (offset + size > na->data_size)
> + size = na->data_size - offset;
> + while (size) {
> + res = ntfs_attr_pread(na, offset, size, buf);
> + if (res < size)
> + perror("ntfs_attr_pread returned less bytes than "
> + "requested.");
Using perror in this case is wrong. When res < size but res >= 0, errno
is not set thus you are using a random errno from whenever something
else failed...
> @@ -436,14 +448,24 @@ static int ntfs_fuse_write(const char *o
> res = -errno;
> goto exit;
> }
> - res = ntfs_attr_pwrite(na, offset, size, buf);
> - if (res == -1)
> - res = -errno;
> - if (res < size)
> - perror("ntfs_attr_pwrite returned less than requested.");
> + while (size) {
> + res = ntfs_attr_pwrite(na, offset, size, buf);
> + if (res < size)
> + perror("ntfs_attr_pwrite returned less bytes than "
> + "requested.");
And same for here.
Best regards,
Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/ & http://www-stu.christs.cam.ac.uk/~aia21/
|