Don't assume File-I/O mode bits match the host's format
authorGary Benson <gbenson@redhat.com>
Tue, 9 Jun 2015 09:00:15 +0000 (10:00 +0100)
committerGary Benson <gbenson@redhat.com>
Tue, 9 Jun 2015 12:24:46 +0000 (13:24 +0100)
commit3ac2e371a1abd1279f66477aa4fc68039da1872e
tree5571999b6a42fbfb6249c98fcf86a790b117d594
parentecef18c564bd609aa7640564747b807bfe1632c6
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.
gdb/ChangeLog
gdb/common/fileio.c
gdb/common/fileio.h
gdb/gdbserver/ChangeLog
gdb/gdbserver/hostio.c
gdb/inf-child.c