summaryrefslogtreecommitdiff
path: root/gdb-7.11/gdb/gdbserver/hostio.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb-7.11/gdb/gdbserver/hostio.c')
-rw-r--r--gdb-7.11/gdb/gdbserver/hostio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gdb-7.11/gdb/gdbserver/hostio.c b/gdb-7.11/gdb/gdbserver/hostio.c
index 242206e7d..ae0b303e8 100644
--- a/gdb-7.11/gdb/gdbserver/hostio.c
+++ b/gdb-7.11/gdb/gdbserver/hostio.c
@@ -297,7 +297,7 @@ handle_open (char *own_buf)
{
char filename[HOSTIO_PATH_MAX];
char *p;
- int fileio_flags, fileio_mode, flags, fd;
+ int fileio_flags, fileio_mode, flags, fd = -1;
mode_t mode;
struct fd_list *new_fd;
@@ -321,7 +321,11 @@ handle_open (char *own_buf)
if (hostio_fs_pid != 0 && the_target->multifs_open != NULL)
fd = the_target->multifs_open (hostio_fs_pid, filename,
flags, mode);
- else
+
+ /* HACK: multifs_open will fail for android applications, because run-as does
+ not switch to the same mount namespace as the running application. Retry
+ with regular open if this happens. */
+ if (fd == -1)
fd = open (filename, flags, mode);
if (fd == -1)