From owner-freebsd-current@FreeBSD.ORG Tue Nov 11 06:31:20 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 21F1116A4CE for ; Tue, 11 Nov 2003 06:31:20 -0800 (PST) Received: from mail.evip.pl (mail.evip.com.pl [212.244.157.179]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7D75B43FBF for ; Tue, 11 Nov 2003 06:31:18 -0800 (PST) (envelope-from w@evip.pl) Received: from drwebc by mail.evip.pl with drweb-scanned (Exim 4.22) id 1AJZY3-0005hp-EF for current@freebsd.org; Tue, 11 Nov 2003 15:31:15 +0100 Received: from w by mail.evip.pl with local (Exim 4.22) id 1AJZY3-0005hj-Ap for current@freebsd.org; Tue, 11 Nov 2003 15:31:15 +0100 Date: Tue, 11 Nov 2003 15:31:15 +0100 From: Wiktor Niesiobedzki To: current@freebsd.org Message-ID: <20031111143115.GB231@mail.evip.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: Mutt/1.4i Sender: Wiktor Niesiobedzki Subject: munmap & cp X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 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, 11 Nov 2003 14:31:20 -0000 Hi, The simple scenario: $ mkdir foo $ cd foo $ touch foo $ cp foo foo2 cp: foo: Invalid argument The problem lies in: src/bin/cp/utils.c:163 if (munmap(p, fs->st_size) < 0) { warn("%s", entp->fts_path); rval = 1; } For the size 0, the munmap will return EINVAL. Returning now error leads us, to think, that no file was copied. My quick hack is to change the line 136: if (S_ISREG(fs->st_mode) && fs->st_size <= 8 * 1048576) { into: if (S_ISREG(fs->st_mode) && fs->st_size <= 8 * 1048576 && fs->st_size > 0) { Anyone feels like to look into it? Cheers, Wiktor Niesiobędzki