From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6419 invoked by alias); 4 Jun 2014 17:09:49 -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 6410 invoked by uid 89); 4 Jun 2014 17:09:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 04 Jun 2014 17:09:48 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s54H9kwL011887 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 4 Jun 2014 13:09:46 -0400 Received: from barimba ([10.3.113.4]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id s54H9id3002139 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Wed, 4 Jun 2014 13:09:45 -0400 From: Tom Tromey To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] constify to_attach References: <1400696455-29563-1-git-send-email-tromey@redhat.com> <537D025D.3090207@redhat.com> Date: Wed, 04 Jun 2014 17:09:00 -0000 In-Reply-To: <537D025D.3090207@redhat.com> (Pedro Alves's message of "Wed, 21 May 2014 20:45:33 +0100") Message-ID: <87egz4d2jr.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2014-06/txt/msg00190.txt.bz2 >>>>> "Pedro" == Pedro Alves writes: >> - dummy = args; >> + dummy = (char *) args; >> pid = strtoul (args, &dummy, 0); >> /* Some targets don't set errno on errors, grrr! */ >> if ((pid == 0 && dummy == args) || dummy != &args[strlen (args)]) Pedro> errno would be necessary to catch overflow, but not to check whether Pedro> the number was syntactically correct. strtoul always sets *endptr to Pedro> point to the address of the first invalid character (and never to NULL). Pedro> So you could just remove the 'dummy' assignment. Pedro> But I'll understand if you want to keep it. I agree that the assignment is not necessary. However, I left it since presumably it is based on some ancient, broken strtoul where it was actually needed, and I didn't want to get into this aspect of the code. Pedro> The patch looks fine to me. I'm pushing it now. Tom