diff options
author | Gary Benson <gbenson@redhat.com> | 2015-06-09 10:00:15 +0100 |
---|---|---|
committer | Gary Benson <gbenson@redhat.com> | 2015-06-09 13:24:46 +0100 |
commit | 3ac2e371a1abd1279f66477aa4fc68039da1872e (patch) | |
tree | 5571999b6a42fbfb6249c98fcf86a790b117d594 /gdb/inf-child.c | |
parent | ecef18c564bd609aa7640564747b807bfe1632c6 (diff) | |
download | gdb-3ac2e371a1abd1279f66477aa4fc68039da1872e.zip gdb-3ac2e371a1abd1279f66477aa4fc68039da1872e.tar.gz gdb-3ac2e371a1abd1279f66477aa4fc68039da1872e.tar.bz2 |
Don't assume File-I/O mode bits match the host's format
inf_child_fileio_open and its gdbserver equivalent both assume that
the mode_t bits defined in gdb/fileio.h are the same as those used
by the open system call, but there is no mechanism to ensure this is
the case. This commit adds a conversion function to handle systems
where the File-I/O definitions do not align with the host's.
gdb/ChangeLog:
* common/fileio.h (fileio_to_host_mode): New declaration.
* common/fileio.c (fileio_to_host_mode): New Function.
* inf-child.c (inf_child_fileio_open): Process mode argument
with fileio_to_host_mode.
gdb/gdbserver/ChangeLog:
* hostio.c (handle_open): Process mode argument with
fileio_to_host_mode.
Diffstat (limited to 'gdb/inf-child.c')
-rw-r--r-- | gdb/inf-child.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gdb/inf-child.c b/gdb/inf-child.c index 084dfa1..013bf0c 100644 --- a/gdb/inf-child.c +++ b/gdb/inf-child.c @@ -213,17 +213,17 @@ inf_child_fileio_open (struct target_ops *self, int *target_errno) { int nat_flags; + mode_t nat_mode; int fd; - if (fileio_to_host_openflags (flags, &nat_flags) == -1) + if (fileio_to_host_openflags (flags, &nat_flags) == -1 + || fileio_to_host_mode (mode, &nat_mode) == -1) { *target_errno = FILEIO_EINVAL; return -1; } - /* We do not need to convert MODE, since the fileio protocol uses - the standard values. */ - fd = gdb_open_cloexec (filename, nat_flags, mode); + fd = gdb_open_cloexec (filename, nat_flags, nat_mode); if (fd == -1) *target_errno = host_to_fileio_error (errno); |