Re: [wmii] libixp client write bug

From: Anthony Martin <ality_AT_pbrane.org>
Date: Thu, 22 Nov 2007 02:25:10 -0800

Silas Boyd-Wickizer <sbw_AT_mit.edu> once said:
> The fid offset is getting incremented on ixp_pwrite and
> incremented twice on ixp_write. I believe the attached patch is
> a fix.

You're write but your patch isn't the best solution. I like
this approach more because we don't deal with f->offset
at all in _pwrite, only after it returns.

diff -r 70ea59334d41 libixp/client.c
--- a/libixp/client.c Mon Nov 05 23:52:11 2007 +0900
+++ b/libixp/client.c Thu Nov 22 02:13:44 2007 -0800
@@ -424,13 +424,13 @@ _pwrite(IxpCFid *f, void *buf, long coun
                 n = min(count-len, f->iounit);
                 fcall.type = TWrite;
                 fcall.fid = f->fid;
- fcall.offset = f->offset;
+ fcall.offset = offset;
                 fcall.data = buf + len;
                 fcall.count = n;
                 if(dofcall(f->client, &fcall) == 0)
                         return -1;
 
- f->offset += fcall.count;
+ offset += fcall.count;
                 len += fcall.count;
 
                 ixp_freefcall(&fcall);
Received on Thu Nov 22 2007 - 11:25:13 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 16:31:35 UTC