From a8c97210b19f4b99b97cff8c76722d2058da97f4 Mon Sep 17 00:00:00 2001 From: Jakub Wysowski Date: Wed, 10 Mar 2021 14:41:55 +0100 Subject: [PATCH] i#2051: in frontend, check for execute not read of DR root dir (#2389) Adds a new static function file_is_executable in frontend.c to check for execute not read of DR root dir. Fixes #2051 --- drmemory/frontend.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drmemory/frontend.c b/drmemory/frontend.c index 8c2c7b30..78420f2a 100644 --- a/drmemory/frontend.c +++ b/drmemory/frontend.c @@ -295,6 +295,13 @@ file_is_readable(char *path) return (drfront_access(path, DRFRONT_READ, &ret) == DRFRONT_SUCCESS && ret); } +static bool +file_is_executable(char *path) +{ + bool ret = false; + return (drfront_access(path, DRFRONT_EXEC, &ret) == DRFRONT_SUCCESS && ret); +} + static void get_absolute_path(const char *src, char *buf, size_t buflen/*# elements*/) { @@ -1297,7 +1304,7 @@ _tmain(int argc, TCHAR *targv[]) } } - if (!file_is_readable(dr_root)) { + if (!file_is_executable(dr_root)) { fatal("invalid -dr_root %s", dr_root); goto error; /* actually won't get here */ }