Skip to content

Commit

Permalink
linux.c: don't use pread64
Browse files Browse the repository at this point in the history
Starting with musl-1.2.4 all LFS64 APIs have been removed since musl is
always 64-bit and yara now fails with implicit function declarations for
pread64.
  • Loading branch information
orbea committed Feb 28, 2024
1 parent 2fcb307 commit e154a95
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions libyara/proc/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <yara/proc.h>
#include <yara/strutils.h>

#define _FILE_OFFSET_BITS 64

typedef struct _YR_PROC_INFO
{
int pid;
Expand Down Expand Up @@ -249,7 +251,7 @@ YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block)
// target process VM.
if (fd == -1)
{
if (pread64(
if (pread(
proc_info->mem_fd,
(void*) context->buffer,
block->size,
Expand All @@ -265,7 +267,7 @@ YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block)
{
goto _exit;
}
if (pread64(
if (pread(
proc_info->pagemap_fd,
pagemap,
sizeof(uint64_t) * block->size / page_size,
Expand All @@ -284,7 +286,7 @@ YR_API const uint8_t* yr_process_fetch_memory_block_data(YR_MEMORY_BLOCK* block)
// swap-backed and if it differs from our mapping.
uint8_t buffer[page_size];

if (pread64(
if (pread(
proc_info->mem_fd,
buffer,
page_size,
Expand Down

0 comments on commit e154a95

Please sign in to comment.