Fix: src.ctf.lttng-live: `fwrite()` does not set `errno`
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Fri, 8 Nov 2019 20:32:05 +0000 (15:32 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 15 Nov 2019 21:10:12 +0000 (16:10 -0500)
Signed-off-by: Francis Deslauriers <francis.deslauriers@efficios.com>
Change-Id: I212b6672c3793449aed800a518386ad10a499923
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2361
Reviewed-by: Simon Marchi <simon.marchi@efficios.com>
src/plugins/ctf/lttng-live/viewer-connection.c

index 4f29cda8723a45344cc8a552c7d1998d5465595e..d6d2851ab932d6c14a8b8667486ac06e7519fdee 100644 (file)
@@ -1248,7 +1248,7 @@ enum lttng_live_get_one_metadata_status lttng_live_get_one_metadata_packet(
        struct lttng_viewer_get_metadata rq;
        struct lttng_viewer_metadata_packet rp;
        char *data = NULL;
-       ssize_t ret_len;
+       ssize_t writelen;
        struct lttng_live_session *session = trace->session;
        struct lttng_live_msg_iter *lttng_live_msg_iter =
                session->lttng_live_msg_iter;
@@ -1343,16 +1343,14 @@ enum lttng_live_get_one_metadata_status lttng_live_get_one_metadata_packet(
        /*
         * Write the metadata to the file handle.
         */
-       do {
-               ret_len = fwrite(data, 1, len, fp);
-       } while (ret_len < 0 && errno == EINTR);
-       if (ret_len < 0) {
+       writelen = fwrite(data, sizeof(uint8_t), len, fp);
+       if (writelen != len) {
                BT_COMP_LOGE_APPEND_CAUSE(self_comp,
                        "Writing in the metadata file stream");
                status = LTTNG_LIVE_GET_ONE_METADATA_STATUS_ERROR;
                goto error;
        }
-       BT_ASSERT(ret_len == len);
+
        *reply_len = len;
        status = LTTNG_LIVE_GET_ONE_METADATA_STATUS_OK;
 
This page took 0.026642 seconds and 4 git commands to generate.