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

_______________________________________________
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to