about summary refs log tree commit diff
path: root/src/afl-analyze.c
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-04-16 17:50:08 +0200
committerDominik Maier <domenukk@gmail.com>2020-04-16 17:50:08 +0200
commit6940e136296d185391a34b5d829a759ac517594e (patch)
tree6823be896d39ee741a31a30b8afde6bdce7137fe /src/afl-analyze.c
parent380ff114e9a369c6b366c40a146eed37602d2620 (diff)
downloadafl++-6940e136296d185391a34b5d829a759ac517594e.tar.gz
removed redundent funcs
Diffstat (limited to 'src/afl-analyze.c')
-rw-r--r--src/afl-analyze.c57
1 files changed, 1 insertions, 56 deletions
diff --git a/src/afl-analyze.c b/src/afl-analyze.c
index f2a54a20..fa58ca81 100644
--- a/src/afl-analyze.c
+++ b/src/afl-analyze.c
@@ -805,61 +805,6 @@ static void usage(u8 *argv0) {
 
 }
 
-/* Find binary. */
-
-static void find_binary(u8 *fname) {
-
-  u8 *        env_path = 0;
-  struct stat st;
-
-  if (strchr(fname, '/') || !(env_path = getenv("PATH"))) {
-
-    target_path = ck_strdup(fname);
-
-    if (stat(target_path, &st) || !S_ISREG(st.st_mode) ||
-        !(st.st_mode & 0111) || st.st_size < 4)
-      FATAL("Program '%s' not found or not executable", fname);
-
-  } else {
-
-    while (env_path) {
-
-      u8 *cur_elem, *delim = strchr(env_path, ':');
-
-      if (delim) {
-
-        cur_elem = ck_alloc(delim - env_path + 1);
-        memcpy(cur_elem, env_path, delim - env_path);
-        delim++;
-
-      } else
-
-        cur_elem = ck_strdup(env_path);
-
-      env_path = delim;
-
-      if (cur_elem[0])
-        target_path = alloc_printf("%s/%s", cur_elem, fname);
-      else
-        target_path = ck_strdup(fname);
-
-      ck_free(cur_elem);
-
-      if (!stat(target_path, &st) && S_ISREG(st.st_mode) &&
-          (st.st_mode & 0111) && st.st_size >= 4)
-        break;
-
-      ck_free(target_path);
-      target_path = 0;
-
-    }
-
-    if (!target_path) FATAL("Program '%s' not found or not executable", fname);
-
-  }
-
-}
-
 /* Main entry point */
 
 int main(int argc, char **argv, char **envp) {
@@ -997,7 +942,7 @@ int main(int argc, char **argv, char **envp) {
 
   set_up_environment();
 
-  find_binary(argv[optind]);
+  target_path = find_binary(argv[optind]);
   detect_file_args(argv + optind, prog_in, &use_stdin);
 
   if (qemu_mode) {