Remove unnecessary check of output parameter
[lttng-tools.git] / src / lib / lttng-ctl / channel.c
index 75a911f2af3ec7080085c648792d23393f82ad1c..b399ea23b52dc2ea5ac036aad4d6f187b724d427 100644 (file)
@@ -81,7 +81,9 @@ int receive_message(struct lttng_notification_channel *channel)
 end:
        return ret;
 error:
-       lttng_dynamic_buffer_set_size(&channel->reception_buffer, 0);
+       if (lttng_dynamic_buffer_set_size(&channel->reception_buffer, 0)) {
+               ret = -1;
+       }
        goto end;
 }
 
@@ -213,6 +215,8 @@ lttng_notification_channel_get_next_notification(
                goto end;
        }
 
+       pthread_mutex_lock(&channel->lock);
+
        if (channel->pending_notifications.count) {
                struct pending_notification *pending_notification;
 
@@ -230,11 +234,9 @@ lttng_notification_channel_get_next_notification(
                cds_list_del(&pending_notification->node);
                channel->pending_notifications.count--;
                free(pending_notification);
-               goto end;
+               goto end_unlock;
        }
 
-       pthread_mutex_lock(&channel->lock);
-
        ret = receive_message(channel);
        if (ret) {
                status = LTTNG_NOTIFICATION_CHANNEL_STATUS_ERROR;
@@ -262,10 +264,8 @@ lttng_notification_channel_get_next_notification(
 
 end_unlock:
        pthread_mutex_unlock(&channel->lock);
+       *_notification = notification;
 end:
-       if (_notification) {
-               *_notification = notification;
-       }
        return status;
 }
 
@@ -442,7 +442,7 @@ int handshake(struct lttng_notification_channel *channel)
 
        pthread_mutex_lock(&channel->lock);
 
-       ret = lttcomm_send_unix_sock(channel->socket, send_buffer,
+       ret = lttcomm_send_creds_unix_sock(channel->socket, send_buffer,
                        sizeof(send_buffer));
        if (ret < 0) {
                goto end_unlock;
This page took 0.026333 seconds and 5 git commands to generate.