int brotli_compress_internal(int input_fd, int output_fd, int quality)
{
int res = -1;
- size_t input_size = lseek(input_fd, 0, SEEK_END);
- lseek(input_fd, 0, SEEK_SET);
+ off_t input_size = lseek(input_fd, 0, SEEK_END);
+ if (input_size < 0) {
+ printf("Can not get file size(lseek failed): %d - %m\n", errno);
+ return res;
+ }
+
+ if (lseek(input_fd, 0, SEEK_SET) < 0) {
+ printf("Can not set file offset to the initial potition(lseek failed): %d - %m\n", errno);
+ return res;
+ }
void *input_file_ptr = MAP_FAILED;
void *output_file_ptr = MAP_FAILED;