From 0b8723299af15273b3a4f2cbf1c5a9e2c13e36d5 Mon Sep 17 00:00:00 2001 From: condret Date: Thu, 24 Aug 2017 00:50:44 +0000 Subject: [PATCH] implement r2 -x --- binr/radare2/radare2.c | 11 +++++++---- libr/core/file.c | 3 --- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/binr/radare2/radare2.c b/binr/radare2/radare2.c index 3e3c006045..2652cafc0f 100644 --- a/binr/radare2/radare2.c +++ b/binr/radare2/radare2.c @@ -475,7 +475,7 @@ int main(int argc, char **argv, char **envp) { return 0; } - while ((c = getopt (argc, argv, "=02AMCwfF:H:hm:e:nk:NdqQs:p:b:B:a:Lui:I:l:P:R:c:D:vVSzuX:" + while ((c = getopt (argc, argv, "=02AMCwxfF:H:hm:e:nk:NdqQs:p:b:B:a:Lui:I:l:P:R:c:D:vVSzuX" #if USE_THREADS "t" #endif @@ -635,7 +635,10 @@ int main(int argc, char **argv, char **envp) { case 'V': return verify_version (1); case 'w': - perms = R_IO_READ | R_IO_WRITE; + perms |= R_IO_WRITE; + break; + case 'x': + perms |= R_IO_EXEC; break; default: help++; @@ -804,7 +807,7 @@ int main(int argc, char **argv, char **envp) { } r_config_set (r.config, "search.in", "dbg.map"); // implicit? r_config_set (r.config, "cfg.debug", "true"); - perms = R_IO_READ | R_IO_WRITE; + perms = R_IO_READ | R_IO_WRITE | R_IO_EXEC; if (optind >= argc) { eprintf ("No program given to -d\n"); return 1; @@ -816,7 +819,7 @@ int main(int argc, char **argv, char **envp) { if (!haveRarunProfile) { pfile = strdup (argv[optind++]); } - perms = R_IO_READ; // XXX. should work with rw too + perms = R_IO_READ | R_IO_EXEC; // XXX. should work with rw too debug = 2; if (!strstr (pfile, "://")) { optind--; // take filename diff --git a/libr/core/file.c b/libr/core/file.c index 38116f2918..883791a15b 100644 --- a/libr/core/file.c +++ b/libr/core/file.c @@ -770,9 +770,6 @@ R_API RCoreFile *r_core_file_open(RCore *r, const char *file, int flags, ut64 lo if (!strcmp (file, "-")) { file = "malloc://512"; } - if (strstr (file, "malloc://")) { - flags = R_IO_READ | R_IO_WRITE; - } //if not flags was passed open it with -r-- if (!flags) { flags = R_IO_READ;