Subject: Re: port-vax/14238: /bin/cp produces a zero length file on port-vax
To: Chuck Cranor <chuck@xxx.research.att.com>
From: Ken Wellsch <kwellsch@tampabay.rr.com>
List: netbsd-bugs
Date: 10/13/2001 21:11:44
Yep, sure enough, following your posting I see that the code
fragment you test is in fact contained in a newly exposed hunk
of code.  Okay, unless some wiz like Matt Thomas fixes gcc, and/or
they are waiting on 2.95.3 instead, I did this and I'm good to go:

diff -u cp/utils.c xcp/utils.c
--- cp/utils.c  Thu Sep 13 05:53:59 2001
+++ xcp/utils.c Sat Oct 13 21:10:40 2001
@@ -144,7 +144,9 @@
                 * This is really a minor hack, but it wins some CPU back.
                 */
 
-               if (fs->st_size <= 8 * 1048576) {
+               int eightMeg = ( 8 * 1024 * 1024 );
+
+               if (fs->st_size <= eightMeg) {
                        p = mmap(NULL, (size_t)fs->st_size, PROT_READ,
                            MAP_FILE|MAP_SHARED, from_fd, (off_t)0);
                        if (p == MAP_FAILED) {