From: Liu Yuan <[email protected]>

Also we ask do_read() to dprintf 'ret' value instead of blindly print %m,
which looks wierd when remote node crashes (ret = 0)

Signed-off-by: Liu Yuan <[email protected]>
---
 lib/net.c       |    6 +++---
 sheep/gateway.c |    8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/net.c b/lib/net.c
index a7deb2a..3527884 100644
--- a/lib/net.c
+++ b/lib/net.c
@@ -265,7 +265,7 @@ reread:
        if (ret < 0 || !ret) {
                if (errno == EINTR)
                        goto reread;
-               eprintf("failed to read from socket: %m\n");
+               eprintf("failed to read from socket: %d\n", ret);
                return 1;
        }
 
@@ -352,7 +352,7 @@ int exec_req(int sockfd, struct sd_req *hdr, void *data,
 
        ret = do_read(sockfd, rsp, sizeof(*rsp));
        if (ret) {
-               eprintf("failed to read a response: %m\n");
+               eprintf("failed to read a response\n");
                return 1;
        }
 
@@ -362,7 +362,7 @@ int exec_req(int sockfd, struct sd_req *hdr, void *data,
        if (*rlen) {
                ret = do_read(sockfd, data, *rlen);
                if (ret) {
-                       eprintf("failed to read the response data: %m\n");
+                       eprintf("failed to read the response data\n");
                        return 1;
                }
        }
diff --git a/sheep/gateway.c b/sheep/gateway.c
index c45490d..c89dd2c 100644
--- a/sheep/gateway.c
+++ b/sheep/gateway.c
@@ -158,7 +158,7 @@ again:
 
                        ret = rsp->result;
                        if (ret != SD_RES_SUCCESS) {
-                               eprintf("fail %"PRIu32"\n", ret);
+                               eprintf("fail %"PRIx32"\n", ret);
                                err_ret = ret;
                        }
                        finish_one_write(wi, i);
@@ -213,7 +213,7 @@ int forward_write_obj_req(struct request *req)
                ret = do_local_io(req, fwd_hdr.epoch);
 
                if (ret != SD_RES_SUCCESS) {
-                       eprintf("fail to write local %"PRIu32"\n", ret);
+                       eprintf("fail to write local %"PRIx32"\n", ret);
                        return ret;
                }
        }
@@ -234,7 +234,7 @@ int forward_write_obj_req(struct request *req)
                if (ret) {
                        sheep_del_fd(v, fd, wi.sock_idx[wi.nr_sent]);
                        err_ret = SD_RES_NETWORK_ERROR;
-                       dprintf("fail %"PRIu32"\n", ret);
+                       dprintf("fail %d\n", ret);
                        break;
                }
 
@@ -244,7 +244,7 @@ int forward_write_obj_req(struct request *req)
                wi.nr_sent++;
        }
 
-       dprintf("nr_sent %d, err %d\n", wi.nr_sent, err_ret);
+       dprintf("nr_sent %d, err %x\n", wi.nr_sent, err_ret);
        if (wi.nr_sent > 0) {
                ret = wait_forward_write(&wi, rsp);
                if (ret != SD_RES_SUCCESS)
-- 
1.7.10.2

-- 
sheepdog mailing list
[email protected]
http://lists.wpkg.org/mailman/listinfo/sheepdog

Reply via email to