[hackers] [ubase] mount: catfile: return 0 or -1 || Hiltjo Posthuma

From: <git_AT_suckless.org>
Date: Fri, 20 Feb 2015 16:36:38 +0100 (CET)

commit a248370eb6b11330426bb6e91515d08b031924bc
Author: Hiltjo Posthuma <hiltjo_AT_codemadness.org>
Date: Fri Feb 20 16:14:11 2015 +0100

    mount: catfile: return 0 or -1

diff --git a/mount.c b/mount.c
index 6061758..db0f38a 100644
--- a/mount.c
+++ b/mount.c
_AT_@ -106,10 +106,10 @@ catfile(FILE *in, FILE *out)
         while (!feof(in)) {
                 bytesread = fread(buf, 1, sizeof(buf), in);
                 if (ferror(in))
- return 0;
+ return -1;
                 fwrite(buf, 1, bytesread, out);
         }
- return 1;
+ return 0;
 }
 
 static void
_AT_@ -160,7 +160,7 @@ main(int argc, char *argv[])
         if (argc < 1 && aflag == 0) {
                 if (!(fp = fopen(files[0], "r")))
                         eprintf("fopen %s:", files[0]);
- if (catfile(fp, stdout) != 1) {
+ if (catfile(fp, stdout) == -1) {
                         weprintf("error while reading %s:", files[0]);
                         status = 1;
                 }
Received on Fri Feb 20 2015 - 16:36:38 CET

This archive was generated by hypermail 2.3.0 : Fri Feb 20 2015 - 16:48:10 CET