shithub: riscv

Download patch

ref: b6005f3a457ff1b40b5fd342c63e2685e5f49b1c
parent: 29c7ca80c9df8f805217be9bb9a9a083ff12912d
author: cinap_lenrek <[email protected]>
date: Mon May 16 17:11:54 EDT 2016

avoid updating offset in pread; avoid diagnostic about vlong mask (charles forsyth)

--- a/sys/src/9/port/sysfile.c
+++ b/sys/src/9/port/sysfile.c
@@ -677,10 +677,12 @@
 	}else
 		nnn = nn = devtab[c->type]->read(c, p, n, off);
 
-	lock(c);
-	c->devoffset += nn;
-	c->offset += nnn;
-	unlock(c);
+	if((c->qid.type & QTDIR) || offp == nil){
+		lock(c);
+		c->devoffset += nn;
+		c->offset += nnn;
+		unlock(c);
+	}
 
 	poperror();
 	cclose(c);
@@ -1278,7 +1280,7 @@
 	p += 28;
 	strncpy((char*)p, d->gid, 28);
 	p += 28;
-	q = d->qid.path & ~DMDIR;	/* make sure doesn't accidentally look like directory */
+	q = (ulong)d->qid.path & ~DMDIR;	/* make sure doesn't accidentally look like directory */
 	if(d->qid.type & QTDIR)	/* this is the real test of a new directory */
 		q |= DMDIR;
 	PBIT32(p, q);