Date: Tue, 11 Nov 2003 15:31:15 +0100 From: Wiktor Niesiobedzki <bsd@w.evip.pl> To: current@freebsd.org Subject: munmap & cp Message-ID: <20031111143115.GB231@mail.evip.pl>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031111143115.GB231>
