[hackers] [st] Use xwrite instead of write. || noname

From: <git_AT_suckless.org>
Date: Sat, 26 Apr 2014 00:05:09 +0200

commit 84f6dbffa5a26e1a2f94f844844d76f80dd6c5a0
Author: noname <noname_AT_inventati.org>
Date: Fri Apr 25 18:27:26 2014 +0400

    Use xwrite instead of write.

diff --git a/st.c b/st.c
index 7dd5e04..f91eb8d 100644
--- a/st.c
+++ b/st.c
_AT_@ -452,7 +452,7 @@ static char utf8encodebyte(long, size_t);
 static size_t utf8len(char *);
 static size_t utf8validate(long *, size_t);
 
-static ssize_t xwrite(int, char *, size_t);
+static ssize_t xwrite(int, const char *, size_t);
 static void *xmalloc(size_t);
 static void *xrealloc(void *, size_t);
 static char *xstrdup(char *);
_AT_@ -518,7 +518,7 @@ static Fontcache frc[16];
 static int frclen = 0;
 
 ssize_t
-xwrite(int fd, char *s, size_t len) {
+xwrite(int fd, const char *s, size_t len) {
         size_t aux = len;
 
         while(len > 0) {
_AT_@ -1270,7 +1270,7 @@ ttyread(void) {
 
 void
 ttywrite(const char *s, size_t n) {
- if(write(cmdfd, s, n) == -1)
+ if(xwrite(cmdfd, s, n) == -1)
                 die("write error on tty: %s
", strerror(errno));
 }
 
Received on Sat Apr 26 2014 - 00:05:09 CEST

This archive was generated by hypermail 2.3.0 : Sat Apr 26 2014 - 00:12:22 CEST