Fix: for librelayd, fix negative reply ret code
authorDavid Goulet <dgoulet@efficios.com>
Tue, 18 Dec 2012 21:50:59 +0000 (16:50 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 18 Dec 2012 21:50:59 +0000 (16:50 -0500)
Trying to negate a uint32_t is kind of difficult so set ret to -1 and
print the actuall host byte order ret code as an error.

Signed-off-by: David Goulet <dgoulet@efficios.com>
src/common/relayd/relayd.c

index 45cb097f616c1bf65b31d5d66ba45966e0877d8b..c883ea5d7f44432ead4ecbc614f8a8abc52686b1 100644 (file)
@@ -133,8 +133,8 @@ int relayd_create_session(struct lttcomm_sock *sock, uint64_t *session_id)
 
        /* Return session id or negative ret code. */
        if (reply.ret_code != LTTNG_OK) {
-               ret = -reply.ret_code;
-               ERR("Relayd create session replied error %d", ret);
+               ret = -1;
+               ERR("Relayd create session replied error %d", reply.ret_code);
                goto error;
        } else {
                ret = 0;
@@ -187,8 +187,8 @@ int relayd_add_stream(struct lttcomm_sock *sock, const char *channel_name,
 
        /* Return session id or negative ret code. */
        if (reply.ret_code != LTTNG_OK) {
-               ret = -reply.ret_code;
-               ERR("Relayd add stream replied error %d", ret);
+               ret = -1;
+               ERR("Relayd add stream replied error %d", reply.ret_code);
        } else {
                /* Success */
                ret = 0;
@@ -399,8 +399,8 @@ int relayd_send_close_stream(struct lttcomm_sock *sock, uint64_t stream_id,
 
        /* Return session id or negative ret code. */
        if (reply.ret_code != LTTNG_OK) {
-               ret = -reply.ret_code;
-               ERR("Relayd close stream replied error %d", ret);
+               ret = -1;
+               ERR("Relayd close stream replied error %d", reply.ret_code);
        } else {
                /* Success */
                ret = 0;
@@ -449,8 +449,7 @@ int relayd_data_pending(struct lttcomm_sock *sock, uint64_t stream_id,
 
        /* Return session id or negative ret code. */
        if (reply.ret_code >= LTTNG_OK) {
-               ret = -reply.ret_code;
-               ERR("Relayd data pending replied error %d", ret);
+               ERR("Relayd data pending replied error %d", reply.ret_code);
        }
 
        /* At this point, the ret code is either 1 or 0 */
@@ -496,8 +495,8 @@ int relayd_quiescent_control(struct lttcomm_sock *sock,
 
        /* Return session id or negative ret code. */
        if (reply.ret_code != LTTNG_OK) {
-               ret = -reply.ret_code;
-               ERR("Relayd quiescent control replied error %d", ret);
+               ret = -1;
+               ERR("Relayd quiescent control replied error %d", reply.ret_code);
                goto error;
        }
 
@@ -540,8 +539,8 @@ int relayd_begin_data_pending(struct lttcomm_sock *sock, uint64_t id)
 
        /* Return session id or negative ret code. */
        if (reply.ret_code != LTTNG_OK) {
-               ret = -reply.ret_code;
-               ERR("Relayd begin data pending replied error %d", ret);
+               ret = -1;
+               ERR("Relayd begin data pending replied error %d", reply.ret_code);
                goto error;
        }
 
This page took 0.026031 seconds and 4 git commands to generate.