Add close.
This commit is contained in:
parent
58c524094e
commit
286237e092
1 changed files with 3 additions and 0 deletions
|
|
@ -151,6 +151,7 @@ xread(int argc, char **argv)
|
||||||
fid = xopen(argv[0], OREAD);
|
fid = xopen(argv[0], OREAD);
|
||||||
while((n = fsread(fid, buf, sizeof buf)) > 0)
|
while((n = fsread(fid, buf, sizeof buf)) > 0)
|
||||||
write(1, buf, n);
|
write(1, buf, n);
|
||||||
|
fsclose(fid);
|
||||||
if(n < 0)
|
if(n < 0)
|
||||||
sysfatal("read error: %r");
|
sysfatal("read error: %r");
|
||||||
threadexitsall(0);
|
threadexitsall(0);
|
||||||
|
|
@ -229,6 +230,7 @@ xwrite(int argc, char **argv)
|
||||||
}
|
}
|
||||||
if(n < 0)
|
if(n < 0)
|
||||||
sysfatal("read error: %r");
|
sysfatal("read error: %r");
|
||||||
|
fsclose(fid);
|
||||||
threadexitsall(0);
|
threadexitsall(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -312,6 +314,7 @@ xrdwr(int argc, char **argv)
|
||||||
if(fswrite(fid, buf, n) != n)
|
if(fswrite(fid, buf, n) != n)
|
||||||
fprint(2, "write: %r\n");
|
fprint(2, "write: %r\n");
|
||||||
}
|
}
|
||||||
|
fsclose(fid);
|
||||||
threadexitsall(0);
|
threadexitsall(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue