stat.c: Simplify stat_client_write().
authorAndre Noll <maan@systemlinux.org>
Tue, 11 Dec 2007 12:08:04 +0000 (13:08 +0100)
committerAndre Noll <maan@systemlinux.org>
Tue, 11 Dec 2007 12:08:04 +0000 (13:08 +0100)
Use write_ok() instead of open coding.

stat.c

diff --git a/stat.c b/stat.c
index 89a1f49..0457a0f 100644 (file)
--- a/stat.c
+++ b/stat.c
@@ -103,20 +103,15 @@ void stat_client_write(const char *msg, int itemnum)
 {
        struct stat_client *sc, *tmp;
        size_t len = strlen(msg);
-       struct timeval tv = {0 , 0};
 
        if (!initialized || !len)
                return;
        list_for_each_entry_safe(sc, tmp, &client_list, node) {
                int fd = sc->fd, ret;
-               fd_set wfds;
 
                if (!((1 << itemnum) & sc->item_mask))
                        continue;
-               FD_ZERO(&wfds);
-               FD_SET(fd, &wfds);
-               ret = para_select(fd + 1, NULL, &wfds, &tv);
-               if (ret > 0) {
+               if (write_ok(fd) > 0) {
                        ret = write(fd, msg, len);
                        PARA_DEBUG_LOG("dumped %s to fd %d, ret = %d\n", msg, fd, ret);
                        if (ret == len)