[Forensics-changes] [yara] 205/368: Fixes for building on linux

Hilko Bengen bengen at moszumanska.debian.org
Sat Jul 1 10:30:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

bengen pushed a commit to annotated tag v3.5.0
in repository yara.

commit 26db645cbeafd6592f141faadc5a00e4c3e31f30
Author: Kyle Reed <kallanreed at outlook.com>
Date:   Sun Feb 28 22:52:26 2016 +0000

    Fixes for building on linux
---
 libyara/proc.c  | 17 ++++++++++-------
 libyara/rules.c |  2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/libyara/proc.c b/libyara/proc.c
index ffa6099..34e2e10 100644
--- a/libyara/proc.c
+++ b/libyara/proc.c
@@ -303,13 +303,14 @@ int yr_process_get_memory(
 
 #include <errno.h>
 
-struct _YR_PROCESS_CONTEXT
+typedef struct _YR_LINUX_CONTEXT
 {
   int pid;
   int mem_fd;
   FILE* maps;
   int attached;
-};
+
+} YR_LINUX_CONTEXT;
 
 int _yr_attach_process(
   int pid,
@@ -317,7 +318,7 @@ int _yr_attach_process(
 {
   char buffer[256];
 
-  _YR_PROCESS_CONTEXT* ctx = (_YR_PROCESS_CONTEXT*)yr_malloc(sizeof(_YR_PROCESS_CONTEXT));
+  YR_LINUX_CONTEXT* ctx = (YR_LINUX_CONTEXT*)yr_malloc(sizeof(YR_LINUX_CONTEXT));
   *context = ctx;
 
   if (ctx == NULL)
@@ -356,18 +357,20 @@ int _yr_detach_process(
   if (context == NULL)
     return ERROR_SUCCESS;
 
-  _YR_PROCESS_CONTEXT* ctx = (_YR_PROCESS_CONTEXT*)context;
+  YR_LINUX_CONTEXT* ctx = (YR_LINUX_CONTEXT*)context;
 
   if(ctx->attached)
     ptrace(PTRACE_DETACH, ctx->pid, NULL, 0);
 
   if (ctx->mem_fd != -1)
-    close(context->mem_fd);
+    close(ctx->mem_fd);
 
   if (ctx->maps != NULL)
     fclose(ctx->maps);
 
   yr_free(ctx);
+
+  return ERROR_SUCCESS;
 }
 
 int _yr_get_process_blocks(
@@ -380,7 +383,7 @@ int _yr_get_process_blocks(
   YR_MEMORY_BLOCK* new_block;
   YR_MEMORY_BLOCK* current = NULL;
 
-  _YR_PROCESS_CONTEXT* ctx = (_YR_PROCESS_CONTEXT*)context;
+  YR_LINUX_CONTEXT* ctx = (YR_LINUX_CONTEXT*)context;
 
   while (fgets(buffer, sizeof(buffer), ctx->maps) != NULL)
   {
@@ -415,7 +418,7 @@ int _yr_read_process_block(
   int result = ERROR_SUCCESS;
   *data = NULL;
 
-  _YR_PROCESS_CONTEXT* ctx = (_YR_PROCESS_CONTEXT*)context;
+  YR_LINUX_CONTEXT* ctx = (YR_LINUX_CONTEXT*)context;
 
   buffer = (uint8_t*)yr_malloc(block->size);
 
diff --git a/libyara/rules.c b/libyara/rules.c
index f8bfb43..10b92e9 100644
--- a/libyara/rules.c
+++ b/libyara/rules.c
@@ -319,7 +319,7 @@ static YR_MEMORY_BLOCK* _yr_get_first_block(
 }
 
 static YR_MEMORY_BLOCK* _yr_get_next_block(
-    YR_BLOCK_ITERATOR*)
+    YR_BLOCK_ITERATOR* iterator)
 {
   return NULL;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/forensics/yara.git



More information about the forensics-changes mailing list