Fix: use off_t type for lseek function return value to avoid overflow
[lttng-tools.git] / src / common / utils.c
index aa11551c30635fd4e423382092fd1871a2534b17..24c3b8ca146ff1fafe8de8da3dd059c7f947f415 100644 (file)
@@ -1335,15 +1335,17 @@ LTTNG_HIDDEN
 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:
This page took 0.025166 seconds and 5 git commands to generate.