From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Pedro Alves <palves@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] find_and_open_script: Fix failed fdopen
Date: Mon, 23 Jan 2012 16:25:00 -0000 [thread overview]
Message-ID: <20120123161751.GA25494@host2.jankratochvil.net> (raw)
In-Reply-To: <4F1D862D.1060608@redhat.com>
On Mon, 23 Jan 2012 17:09:17 +0100, Pedro Alves wrote:
> On 01/23/2012 04:03 PM, Jan Kratochvil wrote:
> > @@ -513,6 +513,17 @@ find_and_open_script (const char *script_file, int search_path,
> > do_cleanups (old_cleanups);
> >
> > *streamp = fdopen (fd, FOPEN_RT);
> > + if (*streamp == NULL)
> > + {
> > + int save_errno = errno;
> > +
> > + if (full_pathp)
> > + xfree (*full_pathp);
> > + do_cleanups (old_cleanups);
>
> This do_cleanups doesn't look right. From the patch context, there's
> already do_cleanups(old_cleanups) call a bit above.
Oops, thanks. Also missing close there.
Regards,
Jan
gdb/
2012-01-23 Jan Kratochvil <jan.kratochvil@redhat.com>
* cli/cli-cmds.c (find_and_open_script): Handle failure of fdopen.
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -513,6 +513,17 @@ find_and_open_script (const char *script_file, int search_path,
do_cleanups (old_cleanups);
*streamp = fdopen (fd, FOPEN_RT);
+ if (*streamp == NULL)
+ {
+ int save_errno = errno;
+
+ close (fd);
+ if (full_pathp)
+ xfree (*full_pathp);
+ errno = save_errno;
+ return 0;
+ }
+
return 1;
}
next prev parent reply other threads:[~2012-01-23 16:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-23 16:09 Jan Kratochvil
2012-01-23 16:14 ` Pedro Alves
2012-01-23 16:25 ` Jan Kratochvil [this message]
2012-01-23 16:38 ` Pedro Alves
2012-01-23 16:43 ` [commit] " Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120123161751.GA25494@host2.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox