From owner-freebsd-bugs@FreeBSD.ORG Mon Aug 21 09:55:20 2006 Return-Path: X-Original-To: freebsd-bugs@freebsd.org Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5C50D16A572 for ; Mon, 21 Aug 2006 09:55:20 +0000 (UTC) (envelope-from ighighi@gmail.com) Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id A15D843D5F for ; Mon, 21 Aug 2006 09:55:16 +0000 (GMT) (envelope-from ighighi@gmail.com) Received: by py-out-1112.google.com with SMTP id o67so2351480pye for ; Mon, 21 Aug 2006 02:55:13 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=ZZsN1cK8W9z4XaNd1HHTEzOfq2oj5kvXZfoNbmEk5E707HtQx5tK/6NCBpSl1TBn+lxVae3Eusp/PsuDipeXx2YR3cKulrl1DxIos26fpH+kwe4aFL8/LS4m3a3MM1ZY9e2sflWW7kyrrWGq0d6JZYluTp6F+DPhspkmS4ximgw= Received: by 10.65.159.20 with SMTP id l20mr6455356qbo; Mon, 21 Aug 2006 02:55:13 -0700 (PDT) Received: by 10.65.253.7 with HTTP; Mon, 21 Aug 2006 02:55:13 -0700 (PDT) Message-ID: Date: Mon, 21 Aug 2006 05:55:13 -0400 From: "Ighighi Ighighi" To: freebsd-bugs@freebsd.org, sheldonh@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: bug in truncate(1) - all FreeBSD versions X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Aug 2006 09:55:20 -0000 The file in question is: /usr/src/usr.bin/truncate/truncate.c I'm working on a portable version of truncate(1) and I noticed a lot of "continue" statements in the main while() loop that skip the call to close(fd) at the end. The obvious consequence is a file descriptor leak... There's still another bug: parselength() does not need to return off_t because its return value is checked in the usual binary (0 vs -1) way. Salutes, Igh