From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25042 invoked by alias); 27 May 2013 14:55:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 25032 invoked by uid 89); 27 May 2013 14:55:24 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,TW_XS autolearn=ham version=3.3.1 Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 27 May 2013 14:55:23 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1UgypU-0000rl-RP from Thomas_Schwinge@mentor.com ; Mon, 27 May 2013 07:55:20 -0700 Received: from SVR-IES-FEM-01.mgc.mentorg.com ([137.202.0.104]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 27 May 2013 07:55:20 -0700 Received: from feldtkeller.schwinge.homeip.net (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.2.247.3; Mon, 27 May 2013 15:55:18 +0100 From: Thomas Schwinge To: Svante Signell , Joel Brobecker CC: Sergio Durigan Junior , Pedro Alves , Subject: Re: Small patch to enable build of gdb-7.6 for GNU/Hurd In-Reply-To: <1369662500.8127.97.camel@s1499.it.kth.se> References: <1369326967.8127.33.camel@s1499.it.kth.se> <20130524042734.GG4017@adacore.com> <519F2A7A.4050002@redhat.com> <1369386446.8127.51.camel@s1499.it.kth.se> <1369654913.8127.84.camel@s1499.it.kth.se> <20130527121028.GB5751@adacore.com> <1369657278.8127.90.camel@s1499.it.kth.se> <1369662500.8127.97.camel@s1499.it.kth.se> User-Agent: Notmuch/0.9-101-g81dad07 (http://notmuchmail.org) Emacs/23.4.1 (i486-pc-linux-gnu) Date: Mon, 27 May 2013 14:55:00 -0000 Message-ID: <87vc64mq0m.fsf@kepler.schwinge.homeip.net> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" X-Virus-Found: No X-SW-Source: 2013-05/txt/msg00954.txt.bz2 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Content-length: 2432 Hi! On Mon, 27 May 2013 15:48:20 +0200, Svante Signell 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 > > > >=20 > > > > * 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 >=20 > * 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: =C2=BBReplace xsnprintf usage with fixed-size buffers with xstrprintf=C2=AB. > 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_fla= gs, char **temp_pathname) > void > nto_init_solib_absolute_prefix (void) > { > - char buf[PATH_MAX * 2], arch_path[PATH_MAX]; > + char buf; =C2=BBchar *buf=C2=AB, as you already figured out. > char *nto_root, *endian; > const char *arch; > + struct cleanup *old_chain; >=20=20 > nto_root =3D nto_target (); > if (strcmp (gdbarch_bfd_arch_info (target_gdbarch ())->arch_name, "i38= 6") =3D=3D 0) > @@ -172,10 +173,11 @@ nto_init_solib_absolute_prefix (void) > =3D=3D BFD_ENDIAN_BIG ? "be" : "le"; > } >=20=20 > - xsnprintf (arch_path, sizeof (arch_path), "%s/%s%s", nto_root, arch, e= ndian); > - > - xsnprintf (buf, sizeof (buf), "set solib-absolute-prefix %s", arch_pat= h); > + buf =3D 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 =C2=BBset solib-absolute-prefix=C2=AB. Do we have to= be concerned here about quoting/path names containing double-quotes et al.? > + old_chain =3D make_cleanup (xfree, buf); > execute_command (buf, 0); > + do_cleanups (old_chain); > } Gr=C3=BC=C3=9Fe, Thomas --=-=-= Content-Type: application/pgp-signature Content-length: 489 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQEcBAEBAgAGBQJRo3PJAAoJEGe3hdm9kOiiWAYH/RgMfCQ8GQ8kntXoNbBlz9Ob RHibr+JPHlwF8Ynqig5RSAoUZPJDajTHA3XMMrL87VZlevjpvf9LYVPCNyvL4Bss EaBs4CUt0/FTS9bidK4Fwac9TLrT0JUfVDqdrRCX+6pUP0MoylDKPrHhZmilJspD ohqWbzJTsmd+sAgkX0jhPMfnKDYcrb+/9j1b0NvOqW5FjBjil70HbJlEegPWGH75 3Ef58LYCszkr31VlU+fszZ9iRjELDinXkXS4r4ytZQ97iq43AgTw9cvsmzbLbCUT wv/KdryhcIfw7aWUJvANhA7J7zlV6dMuYkqPlp/DS6DsK9FGMJwfmhsX2nW6d10= =8D7y -----END PGP SIGNATURE----- --=-=-=--