summaryrefslogtreecommitdiff
path: root/sys/src/cmd/cwfs/9p2.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-09-26 11:44:29 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-09-26 11:44:29 +0200
commitffe4844da89587a3a5cb806abd01d61c1b4b4aa4 (patch)
tree4edd6b4604b1938c825cd3f653dfa83342122056 /sys/src/cmd/cwfs/9p2.c
parent76e0968e35f03ec848093072458e3d15bee2f372 (diff)
cwfs: various cleanups
- consistently refer to Dentry.name length with NAMELEN - make sure whoname is null terminated - remove useless nil check for whoname
Diffstat (limited to 'sys/src/cmd/cwfs/9p2.c')
-rw-r--r--sys/src/cmd/cwfs/9p2.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/src/cmd/cwfs/9p2.c b/sys/src/cmd/cwfs/9p2.c
index 6ead02645..0e9cc57c4 100644
--- a/sys/src/cmd/cwfs/9p2.c
+++ b/sys/src/cmd/cwfs/9p2.c
@@ -348,7 +348,7 @@ attach(Chan* chan, Fcall* f, Fcall* r)
r->qid = file->qid;
- strncpy(chan->whoname, f->uname, sizeof(chan->whoname));
+ snprint(chan->whoname, sizeof(chan->whoname), "%s", f->uname);
chan->whotime = time(nil);
out:
if(p != nil)
@@ -913,7 +913,7 @@ fs_create(Chan* chan, Fcall* f, Fcall* r)
goto phase;
}
- strncpy(d1->name, f->name, sizeof(d1->name));
+ strncpy(d1->name, f->name, NAMELEN);
if(chan == cons.chan){
d1->uid = cons.uid;
d1->gid = cons.gid;
@@ -1014,7 +1014,6 @@ fs_read(Chan* chan, Fcall* f, Fcall* r, uchar* data)
}
iounit = chan->msize-IOHDRSZ;
if(count < 0 || count > iounit){
-fprint(2, "fs_read %d %d\n", count, iounit);
error = Ecount;
goto out;
}
@@ -1786,7 +1785,7 @@ fs_wstat(Chan* chan, Fcall* f, Fcall*, char* strs)
}
d->size = dir.length;
if(dir.name != d->name)
- strncpy(d->name, dir.name, sizeof(d->name));
+ strncpy(d->name, dir.name, NAMELEN);
d->uid = uid;
d->gid = gid;
d->muid = muid;