From owner-freebsd-ports@FreeBSD.ORG Mon Nov 20 10:59:25 2006 Return-Path: X-Original-To: freebsd-ports@freebsd.org Delivered-To: freebsd-ports@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CD03816A47B for ; Mon, 20 Nov 2006 10:59:25 +0000 (UTC) (envelope-from tarkhil@webmail.sub.ru) Received: from mail.sub.ru (webmail.sub.ru [213.247.139.22]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6FC7E43D5A for ; Mon, 20 Nov 2006 10:59:01 +0000 (GMT) (envelope-from tarkhil@webmail.sub.ru) Received: (qmail 16870 invoked by uid 0); 20 Nov 2006 10:59:08 -0000 Received: from webmail.sub.ru (HELO localhost) (213.247.139.22) by techno.sub.ru with SMTP; 20 Nov 2006 10:59:08 -0000 Received: from unknown ([213.247.139.22]) by localhost (webmail.sub.ru [213.247.139.22]) (amavisd-new, port 10024) with SMTP id 10662-18 for ; Mon, 20 Nov 2006 13:59:03 +0300 (MSK) Received: from unknown (HELO ?192.168.0.239?) (tarkhil%sub.ru@213.152.142.74) by techno.sub.ru with SMTP; 20 Nov 2006 10:59:03 -0000 Message-ID: <45618A70.5030701@webmail.sub.ru> Date: Mon, 20 Nov 2006 13:58:56 +0300 From: Alex Povolotsky User-Agent: Thunderbird 1.5 (X11/20060310) MIME-Version: 1.0 To: freebsd-ports@freebsd.org Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at mail.sub.ru Subject: Error in libunp, readline returns incorrect number of bytes on EOF X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Nov 2006 10:59:25 -0000 Hello! I've found that readline() in libunp returns incorrect number of bytes (one extra) when encounters EOF not preceeded by '\n'; Here is the patch I've made for it. === cut === --- lib/readline.c.orig Mon Nov 20 13:51:15 2006 +++ lib/readline.c Mon Nov 20 13:51:41 2006 @@ -39,8 +39,10 @@ } else if (rc == 0) { if (n == 1) return(0); /* EOF, no data read */ - else + else { + n--; /* byte was NOT read */ break; /* EOF, some data was read */ + } } else return(-1); /* error, errno set by read() */ } === cut === It has been tested and runs OK. Alex.