X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-relayd%2Fmain.c;h=a8164ff2246fd3d1a409f9b7e4aaf891e805a82d;hb=a5df8828164272c26e88028b00e6e1ec88ee222d;hp=f68ecdfbcbfe6ab9248c8603676a6a811e59d9aa;hpb=d88744a44aa5f2ca90ab87946692b9eed3120641;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index f68ecdfbc..a8164ff22 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -1588,6 +1588,7 @@ static int rotate_truncate_stream(struct relay_stream *stream) { int ret, new_fd; + off_t lseek_ret; uint64_t diff, pos = 0; char buf[FILE_COPY_BUFFER_SIZE]; @@ -1614,10 +1615,11 @@ int rotate_truncate_stream(struct relay_stream *stream) * Rewind the current tracefile to the position at which the rotation * should have occured. */ - ret = lseek(stream->stream_fd->fd, + lseek_ret = lseek(stream->stream_fd->fd, stream->pos_after_last_complete_data_index, SEEK_SET); - if (ret < 0) { + if (lseek_ret < 0) { PERROR("seek truncate stream"); + ret = -1; goto end; } @@ -1722,7 +1724,8 @@ int try_rotate_stream(struct relay_stream *stream) goto end; } - if (stream->prev_seq < stream->rotate_at_seq_num) { + if (stream->prev_seq < stream->rotate_at_seq_num || + stream->prev_seq == -1ULL) { DBG("Stream %" PRIu64 " no yet ready for rotation", stream->stream_handle); goto end;