summaryrefslogtreecommitdiff
path: root/user/cat.c
diff options
context:
space:
mode:
authorRobert Morris <[email protected]>2019-09-11 10:04:40 -0400
committerRobert Morris <[email protected]>2019-09-11 10:04:40 -0400
commit35010f0d0fae49e91b92585f3e97e56da4ac0082 (patch)
tree12062e40dff173df6c5a4b801e3f5a5ecdd31547 /user/cat.c
parent7e6c37e67e6da62e02089fc3292569103b7e94b3 (diff)
downloadxv6-labs-35010f0d0fae49e91b92585f3e97e56da4ac0082.tar.gz
xv6-labs-35010f0d0fae49e91b92585f3e97e56da4ac0082.tar.bz2
xv6-labs-35010f0d0fae49e91b92585f3e97e56da4ac0082.zip
error exit status is 1
Diffstat (limited to 'user/cat.c')
-rw-r--r--user/cat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/user/cat.c b/user/cat.c
index 7a0b954..36939d8 100644
--- a/user/cat.c
+++ b/user/cat.c
@@ -12,12 +12,12 @@ cat(int fd)
while((n = read(fd, buf, sizeof(buf))) > 0) {
if (write(1, buf, n) != n) {
printf("cat: write error\n");
- exit(-1);
+ exit(1);
}
}
if(n < 0){
printf("cat: read error\n");
- exit(-1);
+ exit(1);
}
}
@@ -28,13 +28,13 @@ main(int argc, char *argv[])
if(argc <= 1){
cat(0);
- exit(-1);
+ exit(1);
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
printf("cat: cannot open %s\n", argv[i]);
- exit(-1);
+ exit(1);
}
cat(fd);
close(fd);