diff options
author | Pedro Alves <palves@redhat.com> | 2015-10-27 16:03:24 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-10-27 16:03:24 +0000 |
commit | 79b289e2d8083691ccb2c943d4502e1af54e81e2 (patch) | |
tree | 4e6a0c381ac238580a4c0a9d1180bded749b2602 /gdb/valprint.c | |
parent | c2f2875869a3e427435ea04bcd416ee2f99e7ee9 (diff) | |
download | gdb-79b289e2d8083691ccb2c943d4502e1af54e81e2.zip gdb-79b289e2d8083691ccb2c943d4502e1af54e81e2.tar.gz gdb-79b289e2d8083691ccb2c943d4502e1af54e81e2.tar.bz2 |
source.c:openp: save/restore errno
openp's return is documented as:
~~~
If a file is found, return the descriptor.
Otherwise, return -1, with errno set for the last name we tried to open. */
~~~
By inspection, I noticed that there are function calls after the ones
that first set errno, and those may clobber errno. It's safer to save
errno when see an open fail, and restore it on exit.
Tested on x86_64 Fedora 20.
gdb/ChangeLog:
2015-10-27 Pedro Alves <palves@redhat.com>
* source.c (openp): New local 'last_errno'. Use it to
save/restore errno.
Diffstat (limited to 'gdb/valprint.c')
0 files changed, 0 insertions, 0 deletions