URI: 
       No need for dmesg_show() to have an fd - ubase - suckless linux base utils
  HTML git clone git://git.suckless.org/ubase
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 4cb108f557d6c34f22166430f853e64335e94461
   DIR parent 10d6bf2f4d73f2712a058327885aca19a44cee02
  HTML Author: sin <sin@2f30.org>
       Date:   Sun, 30 Nov 2014 13:28:01 +0000
       
       No need for dmesg_show() to have an fd
       
       Diffstat:
         M dmesg.c                             |       8 ++++----
       
       1 file changed, 4 insertions(+), 4 deletions(-)
       ---
   DIR diff --git a/dmesg.c b/dmesg.c
       @@ -8,7 +8,7 @@
        
        #include "util.h"
        
       -static void dmesg_show(int fd, const void *buf, size_t n);
       +static void dmesg_show(const void *buf, size_t n);
        
        enum {
                SYSLOG_ACTION_READ_ALL = 3,
       @@ -60,7 +60,7 @@ main(int argc, char *argv[])
                if (n < 0)
                        eprintf("klogctl:");
        
       -        dmesg_show(1, buf, n);
       +        dmesg_show(buf, n);
        
                if (cflag && klogctl(SYSLOG_ACTION_CLEAR, NULL, 0) < 0)
                        eprintf("klogctl:");
       @@ -70,12 +70,12 @@ main(int argc, char *argv[])
        }
        
        static void
       -dmesg_show(int fd, const void *buf, size_t n)
       +dmesg_show(const void *buf, size_t n)
        {
                const char *p = buf;
                ssize_t r;
        
       -        r = write(fd, p, n);
       +        r = write(1, p, n);
                if (r < 0)
                        eprintf("write:");
                if (r > 0 && p[r - 1] != '\n')