/* Get the next subbuffer */
err = kernctl_get_next_subbuf(infd);
if (err != 0) {
+ ret = -err;
/*
* This is a debug message even for single-threaded consumer,
* because poll() have more relaxed criterions than get subbuf,
/* read the whole subbuffer */
err = kernctl_get_padded_subbuf_size(infd, &len);
if (err != 0) {
- errno = -ret;
+ errno = -err;
perror("Getting sub-buffer len failed.");
+ ret = -err;
goto end;
}
/* read the used subbuffer size */
err = kernctl_get_padded_subbuf_size(infd, &len);
if (err != 0) {
- errno = -ret;
+ errno = -err;
perror("Getting sub-buffer len failed.");
+ ret = -err;
goto end;
}
/* write the subbuffer to the tracefile */
err = kernctl_put_next_subbuf(infd);
if (err != 0) {
- errno = -ret;
+ errno = -err;
if (errno == EFAULT) {
perror("Error in unreserving sub buffer\n");
} else if (errno == EIO) {
/* Should never happen with newer LTTng versions */
perror("Reader has been pushed by the writer, last sub-buffer corrupted.");
}
+
+ ret = -err;
goto end;
}
/* Get the next subbuffer */
err = ustctl_get_next_subbuf(handle, buf);
if (err != 0) {
- ret = -ret; /* ustctl_get_next_subbuf returns negative, caller expect positive. */
+ ret = -err; /* ustctl_get_next_subbuf returns negative, caller expect positive. */
/*
* This is a debug message even for single-threaded consumer,
* because poll() have more relaxed criterions than get subbuf,