From owner-freebsd-current@FreeBSD.ORG Tue Jun 24 21:04:24 2008 Return-Path: Delivered-To: current@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 413CA1065671; Tue, 24 Jun 2008 21:04:24 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (nagual.pp.ru [194.87.13.69]) by mx1.freebsd.org (Postfix) with ESMTP id B9CDE8FC15; Tue, 24 Jun 2008 21:04:23 +0000 (UTC) (envelope-from ache@nagual.pp.ru) Received: from nagual.pp.ru (ache@localhost [127.0.0.1]) by nagual.pp.ru (8.14.2/8.14.2) with ESMTP id m5OL4MBB069125; Wed, 25 Jun 2008 01:04:22 +0400 (MSD) (envelope-from ache@nagual.pp.ru) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=nagual.pp.ru; s=default; t=1214341462; bh=qvVE91Lcwlz5mVIV650aFHv+CvS2+3S03Bqkdp7 Kbbc=; l=470; h=Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:In-Reply-To; b=orgW8g7AraRYE9OQcxHeizRu5 qeN4QQrD/Ua9nKjZsnwBrxQ77kpESuHxHfccRPxwDPx8znFnrwQq33wYiAoLKKjXbUw D7A2rX2pQ+OnIlvderASckCmFiBjzVg+zpZMDbbqkSzs4ug+eMYYMOfNs9iqUQm254i 2I5jW8IEOUBs= Received: (from ache@localhost) by nagual.pp.ru (8.14.2/8.14.2/Submit) id m5OL4LmO069124; Wed, 25 Jun 2008 01:04:21 +0400 (MSD) (envelope-from ache) Date: Wed, 25 Jun 2008 01:04:20 +0400 From: Andrey Chernov To: Gabor Kovesdan Message-ID: <20080624210420.GA43007@nagual.pp.ru> Mail-Followup-To: Andrey Chernov , Gabor Kovesdan , hackers@FreeBSD.org, current@FreeBSD.org References: <20080618055851.GA85018@nagual.pp.ru> <86zlpjduew.fsf@ds4.des.no> <20080618083739.GA87100@nagual.pp.ru> <867icndqv5.fsf@ds4.des.no> <4858DBF6.5070001@bluemedia.pl> <86skvbc9gn.fsf@ds4.des.no> <20080618114917.GB89383@nagual.pp.ru> <485E4C69.1080805@FreeBSD.org> <20080622135343.GA72068@nagual.pp.ru> <486159D1.3060704@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <486159D1.3060704@FreeBSD.org> User-Agent: Mutt/1.5.18 (2008-05-17) Cc: hackers@FreeBSD.org, current@FreeBSD.org Subject: Re: CFT: BSD-licensed grep [Fwd: cvs commit: ports/textproc/bsdgrep Makefile distinfo] X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jun 2008 21:04:24 -0000 On Tue, Jun 24, 2008 at 10:32:17PM +0200, Gabor Kovesdan wrote: > ch = fgetwc(f); You must clear errno before and handle EILSEQ possible coming after fgetwc() somehow. Perhaps by return ret = 1 (binary), I am not sure. fgetwc() returns WEOF in that case which is not true end of file. > if ((s = mbstowcs(NULL, f->base, 0)) == -1) > return (0); The same here. Check EILSEQ and return 1 -- http://ache.pp.ru/