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.

However configure.ac already sets AC_SYS_LARGEFILE so changing them all
to pread will work with both glibc and musl.
  • Loading branch information
orbea committed Feb 27, 2024
1 parent 8b21612 commit 839d5ee
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libyara/proc/linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <yara/proc.h>
#include <yara/strutils.h>

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

typedef struct _YR_PROC_INFO
{
int pid;
Expand Down Expand Up @@ -249,7 +253,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 +269,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 +288,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 839d5ee

Please sign in to comment.