commit 821a980ab4be90a58e40824f70ee7556b7f7feb6
Author: sin <[email protected]>
Date:   Thu Nov 20 22:51:34 2014 +0000

    Respect exit status in tail(1)
    
    There are more instances of this problem.

diff --git a/tail.c b/tail.c
index b399cf2..b3a8b30 100644
--- a/tail.c
+++ b/tail.c
@@ -23,6 +23,7 @@ main(int argc, char *argv[])
        FILE *fp;
        void (*tail)(FILE *, const char *, long) = taketail;
        char *lines;
+       int ret = 0;
 
        ARGBEGIN {
        case 'n':
@@ -43,14 +44,14 @@ main(int argc, char *argv[])
                for (; argc > 0; argc--, argv++) {
                        if (!(fp = fopen(argv[0], "r"))) {
                                weprintf("fopen %s:", argv[0]);
+                               ret = 1;
                                continue;
                        }
                        tail(fp, argv[0], n);
                        fclose(fp);
                }
        }
-
-       return 0;
+       return ret;
 }
 
 static void


Reply via email to