diff options
author | Nicholas Noll <nbnoll@eml.cc> | 2021-12-10 09:16:08 -0800 |
---|---|---|
committer | Nicholas Noll <nbnoll@eml.cc> | 2021-12-10 09:16:08 -0800 |
commit | 25537c3d3b9b68af91573dec39d1f46c3d97f735 (patch) | |
tree | 3f2ea6207a28fe9610d767dd78fb24d17f858ce0 /src/cmd/core/cat.c | |
parent | f4aef385bdd41b02ef58b5366fa9318ecdc6e37e (diff) |
Checkin: small sprawling updates
Small touches to multiple locations in base.
Nothing major
Diffstat (limited to 'src/cmd/core/cat.c')
-rw-r--r-- | src/cmd/core/cat.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cmd/core/cat.c b/src/cmd/core/cat.c index aeed1be..92b082d 100644 --- a/src/cmd/core/cat.c +++ b/src/cmd/core/cat.c @@ -11,15 +11,16 @@ usage(void) static void cat(int fd, char *s) { + int err; intptr nr, nw; char buf[8192]; - while(!(sys·read(fd, buf, sizeof(buf), &nr))){ + while(!(err=sys·read(fd, buf, sizeof(buf), &nr)) && nr>0){ if(sys·write(1, buf, nr, &nw) || nr != nw) fmt·panic("write error copying %s: %r", s); } - if(nr<0) + if(err) fmt·panic("error reading %s: %r", s); } |