source.c:openp: save/restore errno
authorPedro Alves <palves@redhat.com>
Tue, 27 Oct 2015 16:03:24 +0000 (16:03 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 27 Oct 2015 16:03:24 +0000 (16:03 +0000)
commit79b289e2d8083691ccb2c943d4502e1af54e81e2
tree4e6a0c381ac238580a4c0a9d1180bded749b2602
parentc2f2875869a3e427435ea04bcd416ee2f99e7ee9
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.
gdb/ChangeLog
gdb/source.c
This page took 0.068201 seconds and 4 git commands to generate.