From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from kwanyin.sergiodj.net (kwanyin.sergiodj.net [158.69.185.54]) by sourceware.org (Postfix) with ESMTPS id D20E0388C002 for ; Fri, 29 May 2020 11:16:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D20E0388C002 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [binutils-gdb] Use errno value of first openp failure From: gdb-buildbot@sergiodj.net To: gdb-testers@sourceware.org Message-Id: <96445f0b66af20343e2ffed08c4da8cfac101a03@gdb-build> Date: Fri, 29 May 2020 07:16:57 -0400 X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-testers@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-testers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 11:17:00 -0000 *** TEST RESULTS FOR COMMIT 96445f0b66af20343e2ffed08c4da8cfac101a03 *** commit 96445f0b66af20343e2ffed08c4da8cfac101a03 Author: Hannes Domani AuthorDate: Wed May 13 12:41:51 2020 +0200 Commit: Hannes Domani CommitDate: Wed May 27 19:41:07 2020 +0200 Use errno value of first openp failure Fixes this testsuite fail on Windows: FAIL: gdb.base/bad-file.exp: directory If both tries to open the file fail (without and with ".exe"), use the errno value of the first try. gdb/ChangeLog: 2020-05-27 Hannes Domani * exec.c (exec_file_attach): Use errno value of first openp failure. diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 08641e5721..2f2958c599 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2020-05-27 Hannes Domani + + * exec.c (exec_file_attach): Use errno value of first openp failure. + 2020-05-27 Hannes Domani * nat/windows-nat.c (windows_thread_info::~windows_thread_info): diff --git a/gdb/exec.c b/gdb/exec.c index 14c77495a3..ee13c5e027 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)