aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/exec.c3
2 files changed, 7 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 08641e5..2f2958c 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2020-05-27 Hannes Domani <ssbssa@yahoo.de>
+ * exec.c (exec_file_attach): Use errno value of first openp failure.
+
+2020-05-27 Hannes Domani <ssbssa@yahoo.de>
+
* nat/windows-nat.c (windows_thread_info::~windows_thread_info):
Don't close thread handle.
diff --git a/gdb/exec.c b/gdb/exec.c
index 14c7749..ee13c5e 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -435,6 +435,7 @@ exec_file_attach (const char *filename, int from_tty)
#if defined(__GO32__) || defined(_WIN32) || defined(__CYGWIN__)
if (scratch_chan < 0)
{
+ int first_errno = errno;
char *exename = (char *) alloca (strlen (filename) + 5);
strcat (strcpy (exename, filename), ".exe");
@@ -443,6 +444,8 @@ exec_file_attach (const char *filename, int from_tty)
O_RDWR | O_BINARY
: O_RDONLY | O_BINARY,
&scratch_storage);
+ if (scratch_chan < 0)
+ errno = first_errno;
}
#endif
if (scratch_chan < 0)