From: Thomas Schwinge <thomas@codesourcery.com>
To: Svante Signell <svante.signell@gmail.com>,
Joel Brobecker <brobecker@adacore.com>
Cc: Sergio Durigan Junior <sergiodj@redhat.com>,
Pedro Alves <palves@redhat.com>, <gdb-patches@sourceware.org>
Subject: Re: Small patch to enable build of gdb-7.6 for GNU/Hurd
Date: Mon, 27 May 2013 14:55:00 -0000 [thread overview]
Message-ID: <87vc64mq0m.fsf@kepler.schwinge.homeip.net> (raw)
In-Reply-To: <1369662500.8127.97.camel@s1499.it.kth.se>
[-- Attachment #1: Type: text/plain, Size: 2432 bytes --]
Hi!
On Mon, 27 May 2013 15:48:20 +0200, Svante Signell <svante.signell@gmail.com> wrote:
> On Mon, 2013-05-27 at 14:21 +0200, Svante Signell wrote:
> > On Mon, 2013-05-27 at 16:10 +0400, Joel Brobecker wrote:
> > > > 2013-05-27 Svante Signell <srs@hurd-2013.my.own.domain>
> > > >
> > > > * nto-tdep.c (nto_init_solib_absolute_prefix): Solve build
> > > > problems for systems not defining PATH_MAX by using xstrprintf and
> > > > a cleanup.
> > > While looking at this code, I don't think you'll need 2 xstrprintf
> > > either. Can you try the attached patch?
> I had to change the second make_cleanup call to do_cleanups instead, see
> the updated patch.
Right.
> 2013-05-27 Svante Signell <svante.signell@gmail.com>
>
> * nto-tdep.c (nto_init_solib_absolute_prefix): Solve build
> problems for systems not defining PATH_MAX by using xstrprintf
> followed by a cleanup.
GNU ChangeLogs are to describe what is changed, not why, so I'd use
something like: »Replace xsnprintf usage with fixed-size buffers with
xstrprintf«.
> diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c
> index 748869f..cf4fd60 100644
> --- a/gdb/nto-tdep.c
> +++ b/gdb/nto-tdep.c
> @@ -147,9 +147,10 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname)
> void
> nto_init_solib_absolute_prefix (void)
> {
> - char buf[PATH_MAX * 2], arch_path[PATH_MAX];
> + char buf;
»char *buf«, as you already figured out.
> char *nto_root, *endian;
> const char *arch;
> + struct cleanup *old_chain;
>
> nto_root = nto_target ();
> if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i386") == 0)
> @@ -172,10 +173,11 @@ nto_init_solib_absolute_prefix (void)
> == BFD_ENDIAN_BIG ? "be" : "le";
> }
>
> - xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, endian);
> -
> - xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_path);
> + buf = xstrprintf ("set solib-absolute-prefix \"%s/%s%s\"",
> + nto_root, arch, endian);
The original code does not put double-quotes around the (former)
arch_path argument to »set solib-absolute-prefix«. Do we have to be
concerned here about quoting/path names containing double-quotes et al.?
> + old_chain = make_cleanup (xfree, buf);
> execute_command (buf, 0);
> + do_cleanups (old_chain);
> }
Grüße,
Thomas
[-- Attachment #2: Type: application/pgp-signature, Size: 489 bytes --]
prev parent reply other threads:[~2013-05-27 14:55 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-23 16:36 Svante Signell
2013-05-23 17:08 ` Tom Tromey
2013-05-23 17:21 ` Svante Signell
2013-05-23 17:27 ` Tom Tromey
2013-05-23 17:54 ` Svante Signell
2013-05-24 3:01 ` Sergio Durigan Junior
2013-05-24 2:59 ` Sergio Durigan Junior
2013-05-24 4:27 ` Joel Brobecker
2013-05-24 8:53 ` Pedro Alves
2013-05-24 9:07 ` Svante Signell
2013-05-24 9:13 ` Sergio Durigan Junior
2013-05-27 11:41 ` Svante Signell
2013-05-27 12:10 ` Joel Brobecker
2013-05-27 12:21 ` Svante Signell
2013-05-27 13:48 ` Svante Signell
2013-05-27 13:57 ` Svante Signell
2013-05-27 14:31 ` Joel Brobecker
2013-05-27 15:59 ` Svante Signell
2013-05-29 9:26 ` Joel Brobecker
2013-05-29 12:18 ` Svante Signell
2013-05-27 16:03 ` New patch: " Svante Signell
2013-05-29 9:42 ` Joel Brobecker
2013-05-29 12:49 ` Svante Signell
2013-05-27 14:55 ` Thomas Schwinge [this message]
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=87vc64mq0m.fsf@kepler.schwinge.homeip.net \
--to=thomas@codesourcery.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=palves@redhat.com \
--cc=sergiodj@redhat.com \
--cc=svante.signell@gmail.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