From 5c52991cd8aa1c72384fdc47acef1f3f8a42d4e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=A4rkl?= Date: Sat, 22 Sep 2018 18:00:21 +0200 Subject: [PATCH] Update r2 and use R_PERM flags --- radare2 | 2 +- src/AnalTask.cpp | 4 ++-- src/Cutter.cpp | 6 +++--- src/Cutter.h | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/radare2 b/radare2 index 126b4088..28bdc63a 160000 --- a/radare2 +++ b/radare2 @@ -1 +1 @@ -Subproject commit 126b4088937fcfbc32e73b54aa42943ae96a561f +Subproject commit 28bdc63a7d41c748e946551bae70f74df98c1e0f diff --git a/src/AnalTask.cpp b/src/AnalTask.cpp index 17737f6d..6b0170df 100644 --- a/src/AnalTask.cpp +++ b/src/AnalTask.cpp @@ -26,9 +26,9 @@ void AnalTask::runTask() log(tr("Loading Binary...\n")); openFailed = false; - int perms = R_IO_READ | R_IO_EXEC; + int perms = R_PERM_RX; if (options.writeEnabled) - perms |= R_IO_WRITE; + perms |= R_PERM_W; // Demangle (must be before file Core()->loadFile) Core()->setConfig("bin.demangle", options.demangle); diff --git a/src/Cutter.cpp b/src/Cutter.cpp index c059f439..cb1a8865 100644 --- a/src/Cutter.cpp +++ b/src/Cutter.cpp @@ -289,7 +289,7 @@ bool CutterCore::loadFile(QString path, ut64 baddr, ut64 mapaddr, int perms, int r_core_cmd0 (core_, "s entry0"); } - if (perms & R_IO_WRITE) { + if (perms & R_PERM_W) { r_core_cmd0 (core_, "omfg+w"); } @@ -302,8 +302,8 @@ bool CutterCore::tryFile(QString path, bool rw) { CORE_LOCK(); RCoreFile *cf; - int flags = R_IO_READ; - if (rw) flags |= R_IO_WRITE; + int flags = R_PERM_R; + if (rw) flags = R_PERM_RW; cf = r_core_file_open(this->core_, path.toUtf8().constData(), flags, 0LL); if (!cf) { return false; diff --git a/src/Cutter.h b/src/Cutter.h index 524dbbc3..8910882c 100644 --- a/src/Cutter.h +++ b/src/Cutter.h @@ -427,7 +427,7 @@ public: void setCurrentBits(int bits, RVA offset = RVA_INVALID); /* File related methods */ - bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = R_IO_READ, + bool loadFile(QString path, ut64 baddr = 0LL, ut64 mapaddr = 0LL, int perms = R_PERM_R, int va = 0, bool loadbin = false, const QString &forceBinPlugin = nullptr); bool tryFile(QString path, bool rw); void openFile(QString path, RVA mapaddr);