From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70987 invoked by alias); 25 Oct 2016 12:57:34 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 70976 invoked by uid 89); 25 Oct 2016 12:57:34 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx2.suse.de From: Andreas Schwab To: Adhemerval Zanella Cc: libc-alpha@sourceware.org Subject: Re: [PATCH] Fix undefined behaviour inconsistent for strtok References: <1477393113-3845-1-git-send-email-adhemerval.zanella@linaro.org> <385e684a-8101-fd26-d2ff-464515a2e88c@linaro.org> X-Yow: I'm having fun HITCHHIKING to CINCINNATI or FAR ROCKAWAY!! Date: Tue, 25 Oct 2016 12:57:00 -0000 In-Reply-To: <385e684a-8101-fd26-d2ff-464515a2e88c@linaro.org> (Adhemerval Zanella's message of "Tue, 25 Oct 2016 10:33:15 -0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2016-10/txt/msg00414.txt.bz2 On Okt 25 2016, Adhemerval Zanella wrote: > On 25/10/2016 09:31, Andreas Schwab wrote: >> On Okt 25 2016, Adhemerval Zanella wrote: >> >>> * string/strtok.c (strtok): Return null is previous input is also >> >> s/is/if/ >> >>> diff --git a/string/strtok.c b/string/strtok.c >>> index 7a4574d..5c4b309 100644 >>> --- a/string/strtok.c >>> +++ b/string/strtok.c >>> @@ -40,8 +40,8 @@ STRTOK (char *s, const char *delim) >>> { >>> char *token; >>> >>> - if (s == NULL) >>> - s = olds; >>> + if ((s == NULL) && ((s = olds) == NULL)) >> >> Please avoid assignment in an expression. And the parens are redundant. >> >> Andreas. >> > > Right, with these fixes would it be acceptable? I don't see much point in supporting invalid use of strtok. Andreas. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."