[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23150 - monkey/branches/MonkeyBacktracking/monkey/src/path
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23150 - monkey/branches/MonkeyBacktracking/monkey/src/pathologist |
Date: |
Tue, 7 Aug 2012 17:30:25 +0200 |
Author: safey
Date: 2012-08-07 17:30:25 +0200 (Tue, 07 Aug 2012)
New Revision: 23150
Modified:
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
Log:
Check files existence
Modified:
monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
===================================================================
--- monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
2012-08-07 15:02:38 UTC (rev 23149)
+++ monkey/branches/MonkeyBacktracking/monkey/src/pathologist/pathologist.c
2012-08-07 15:30:25 UTC (rev 23150)
@@ -46,6 +46,15 @@
static int reverseExecutionAllowed = MONKEY_NO;
static int ret = 0;
+static int checkFileExistence(const char *filePath) {
+ struct stat statBuff;
+ if (0 == stat(filePath, &statBuff)) {
+ return MONKEY_YES;
+ }
+ return MONKEY_NO;
+}
+
+
static int checkELF(const char *binaryPath) {
int ch;
const char ELF[5] = {0x7f, 'E', 'L', 'F', '\0'}; // ELF magic number
@@ -75,6 +84,35 @@
int result;
struct MONKEY_ACTION_Context *cntxt;
+ /* Check files existence */
+ if (MONKEY_NO == checkFileExistence(binaryName)) {
+ fprintf(stderr, "Error: Target binary file does not exist.\n");
+ ret = 1;
+ return;
+ }
+
+ if (MONKEY_NO == checkFileExistence(edbFilePath)) {
+ fprintf(stderr, "Error: Expression database file does not exist.\n");
+ ret = 1;
+ return;
+ }
+
+ if (NULL != gdbBinaryPath) {
+ if (MONKEY_NO == checkFileExistence(gdbBinaryPath)) {
+ fprintf(stderr, "Error: gdb binary file does not exist.\n");
+ ret = 1;
+ return;
+ }
+ }
+
+ if (NULL != valgrindBinaryPath) {
+ if (MONKEY_NO == checkFileExistence(valgrindBinaryPath)) {
+ fprintf(stderr, "Error: valgrind binary file does not
exist.\n");
+ ret = 1;
+ return;
+ }
+ }
+
/* Check if the target program is and ELF binary */
if (MONKEY_NO == checkELF(binaryName)) {
FILE* targetProgramPipe;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23150 - monkey/branches/MonkeyBacktracking/monkey/src/pathologist,
gnunet <=