int viewer_get_packet(struct relay_connection *conn)
{
int ret;
+ off_t lseek_ret;
char *reply = NULL;
struct lttng_viewer_get_packet get_packet_info;
struct lttng_viewer_trace_packet reply_header;
}
pthread_mutex_lock(&vstream->stream->lock);
- ret = lseek(vstream->stream_fd->fd, be64toh(get_packet_info.offset),
+ lseek_ret = lseek(vstream->stream_fd->fd, be64toh(get_packet_info.offset),
SEEK_SET);
- if (ret < 0) {
+ if (lseek_ret < 0) {
PERROR("lseek fd %d to offset %" PRIu64, vstream->stream_fd->fd,
be64toh(get_packet_info.offset));
goto error;
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];
* 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;
}
int clear_metadata_file(int fd)
{
int ret;
+ off_t lseek_ret;
- ret = lseek(fd, 0, SEEK_SET);
- if (ret < 0) {
+ lseek_ret = lseek(fd, 0, SEEK_SET);
+ if (lseek_ret < 0) {
PERROR("lseek");
+ ret = -1;
goto end;
}
int utils_truncate_stream_file(int fd, off_t length)
{
int ret;
+ off_t lseek_ret;
ret = ftruncate(fd, length);
if (ret < 0) {
PERROR("ftruncate");
goto end;
}
- ret = lseek(fd, length, SEEK_SET);
- if (ret < 0) {
+ lseek_ret = lseek(fd, length, SEEK_SET);
+ if (lseek_ret < 0) {
PERROR("lseek");
+ ret = -1;
goto end;
}
end: