From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30115 invoked by alias); 19 May 2009 09:52:14 -0000 Received: (qmail 30106 invoked by uid 22791); 19 May 2009 09:52:13 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from mail-out.m-online.net (HELO mail-out.m-online.net) (212.18.0.10) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 19 May 2009 09:52:07 +0000 Received: from mail01.m-online.net (mail.m-online.net [192.168.3.149]) by mail-out.m-online.net (Postfix) with ESMTP id 5B9C21C00109; Tue, 19 May 2009 11:52:03 +0200 (CEST) Received: from localhost (dynscan2.mnet-online.de [192.168.1.215]) by mail.m-online.net (Postfix) with ESMTP id 74B5A90218; Tue, 19 May 2009 11:52:03 +0200 (CEST) Received: from mail.mnet-online.de ([192.168.3.149]) by localhost (dynscan2.mnet-online.de [192.168.1.215]) (amavisd-new, port 10024) with ESMTP id 7sH2bmqh1fAJ; Tue, 19 May 2009 11:52:02 +0200 (CEST) Received: from igel.home (DSL01.83.171.189.133.ip-pool.NEFkom.net [83.171.189.133]) by mail.mnet-online.de (Postfix) with ESMTP; Tue, 19 May 2009 11:52:02 +0200 (CEST) Received: by igel.home (Postfix, from userid 501) id 2E8D810C587; Tue, 19 May 2009 11:52:00 +0200 (CEST) From: Andreas Schwab To: Doug Evans Cc: Pedro Alves , gdb-patches@sourceware.org Subject: Re: Workaround for glibc/BZ5983: following a child fork shows stale parent threads in the child. References: <200905181813.48596.pedro@codesourcery.com> X-Yow: NOW, I'm taking the NEXT FLIGHT to ACAPULCO so I can write POEMS about BROKEN GUITAR STRINGS and sensuous PRE-TEENS!! Date: Tue, 19 May 2009 09:52:00 -0000 In-Reply-To: (Doug Evans's message of "Mon, 18 May 2009 23:26:07 -0700") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.93 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 X-SW-Source: 2009-05/txt/msg00395.txt.bz2 Doug Evans writes: > On Mon, May 18, 2009 at 10:13 AM, Pedro Alves wr= ote: >> [...] >> + =C2=A0 =C2=A0 =C2=A0while (fgets (buf, sizeof (buf), status_file)) >> + =C2=A0 =C2=A0 =C2=A0 { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (strncmp (buf, "Tgid:", 5) =3D=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 { >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 tgid =3D strtoul (buf + strl= en ("Tgid:"), NULL, 10); >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 break; >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 } >> + =C2=A0 =C2=A0 =C2=A0 } > > This works, but only because of an assumption of the strlen including > the trailing NUL in "Tgid:" consuming the TAB between "Tgid:" and the > number. strlen does not include the trailing NUL, sizeof does. Andreas. --=20 Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different."