[hackers] [ubase] No need for dmesg_show() to have an fd || sin

From: <git_AT_suckless.org>
Date: Sun, 30 Nov 2014 14:28:36 +0100

commit 4cb108f557d6c34f22166430f853e64335e94461
Author: sin <sin_AT_2f30.org>
Date: Sun Nov 30 13:28:01 2014 +0000

    No need for dmesg_show() to have an fd

diff --git a/dmesg.c b/dmesg.c
index 31b7cb6..1c3f5c6 100644
--- a/dmesg.c
+++ b/dmesg.c
_AT_@ -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,
_AT_@ -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:");
_AT_@ -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')
Received on Sun Nov 30 2014 - 14:28:36 CET

This archive was generated by hypermail 2.3.0 : Sun Nov 30 2014 - 14:36:09 CET