commit 983f1baa16e502367d9d92046fbf27c75c84cebf
parent f758fba72649d7d5a10d12c17f637a693cb5ff78
Author: Kris Maglione <jg@suckless.org>
Date: Mon, 26 Mar 2007 17:21:05 -0400
Fixed some bugs.
Diffstat:
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c
@@ -515,7 +515,7 @@ fs_attach(Ixp9Req *r) {
FileId *f = get_file();
f->tab = dirtab[FsRoot][0];
f->tab.name = estrdup("/");
- f->content.ref = nil; /* shut up valgrind */
+ f->content.ref = nil;
r->fid->aux = f;
r->fid->qid.type = f->tab.qtype;
r->fid->qid.path = QID(f->tab.type, 0);
diff --git a/cmd/wmiir.c b/cmd/wmiir.c
@@ -22,18 +22,18 @@ usage() {
/* Utility Functions */
static void
-write_data(IxpCFid *fid) {
+write_data(IxpCFid *fid, char *name) {
void *buf;
uint len;
buf = ixp_emalloc(fid->iounit);;
while((len = read(0, buf, fid->iounit)) > 0)
if(ixp_write(fid, buf, len) != len)
- fatal("cannot write file: %s\n", errstr);
+ fatal("cannot write file '%s': %s\n", name, errstr);
/* do an explicit empty write when no writing has been done yet */
if(fid->offset == 0)
if(ixp_write(fid, buf, 0) != 0)
- fatal("cannot write file: %s\n", errstr);
+ fatal("cannot write file '%s': %s\n", name, errstr);
free(buf);
}
@@ -109,7 +109,7 @@ xwrite(int argc, char *argv[]) {
if(fid == nil)
fatal("Can't open file '%s': %s\n", file, errstr);
- write_data(fid);
+ write_data(fid, file);
return 0;
}
@@ -161,12 +161,12 @@ xcreate(int argc, char *argv[]) {
}ARGEND;
file = EARGF(usage());
- fid = ixp_create(client, file, 0777, P9_OREAD);
+ fid = ixp_create(client, file, 0777, P9_OWRITE);
if(fid == nil)
fatal("Can't create file '%s': %s\n", file, errstr);
if((fid->qid.type&P9_DMDIR) == 0)
- write_data(fid);
+ write_data(fid, file);
return 0;
}