mount: catfile: return 0 or -1
This commit is contained in:
parent
314f2a77f0
commit
a248370eb6
6
mount.c
6
mount.c
@ -106,10 +106,10 @@ catfile(FILE *in, FILE *out)
|
|||||||
while (!feof(in)) {
|
while (!feof(in)) {
|
||||||
bytesread = fread(buf, 1, sizeof(buf), in);
|
bytesread = fread(buf, 1, sizeof(buf), in);
|
||||||
if (ferror(in))
|
if (ferror(in))
|
||||||
return 0;
|
return -1;
|
||||||
fwrite(buf, 1, bytesread, out);
|
fwrite(buf, 1, bytesread, out);
|
||||||
}
|
}
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -160,7 +160,7 @@ main(int argc, char *argv[])
|
|||||||
if (argc < 1 && aflag == 0) {
|
if (argc < 1 && aflag == 0) {
|
||||||
if (!(fp = fopen(files[0], "r")))
|
if (!(fp = fopen(files[0], "r")))
|
||||||
eprintf("fopen %s:", files[0]);
|
eprintf("fopen %s:", files[0]);
|
||||||
if (catfile(fp, stdout) != 1) {
|
if (catfile(fp, stdout) == -1) {
|
||||||
weprintf("error while reading %s:", files[0]);
|
weprintf("error while reading %s:", files[0]);
|
||||||
status = 1;
|
status = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user