Use send() when writing to sockets, and the return type is ssize_t.
authorGuus Sliepen <guus@tinc-vpn.org>
Thu, 2 Jun 2011 22:34:30 +0000 (00:34 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Thu, 2 Jun 2011 22:34:30 +0000 (00:34 +0200)
src/net_socket.c

index 80f37a4..d470fef 100644 (file)
@@ -454,7 +454,7 @@ static void handle_meta_write(int sock, short events, void *data) {
 
        connection_t *c = data;
 
-       size_t outlen = write(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset);
+       ssize_t outlen = send(c->socket, c->outbuf.data + c->outbuf.offset, c->outbuf.len - c->outbuf.offset, 0);
        if(outlen <= 0) {
                logger(LOG_ERR, "Onoes, outlen = %zd (%s)", outlen, strerror(errno));
                terminate_connection(c, c->status.active);