In <38CFA76F.42FC9245@austin.ibm.com>, "David R. Favor" writes: :High weirdness abounds... I am totally confused about what is suppose to :be happening here: : :When I replace the code in pp_sys.c with the following and run it (outside dbx :): : : { : /* See the note at doio.c:do_print about filesize limits. --jhi */ : int fn = PerlIO_fileno(IoIFP(io)); : Off_t ilen = 1943; : length = PerlLIO_write(fn, buffer+offset, ilen); : printf("fn=%d buffer=%X offset=%d isize=%d ilen=%d osize=%d olen=% :d\n", : fn, buffer, offset, sizeof(ilen), ilen, sizeof(length) :, length); : } : :I get the following output: : : dgsp>cat ~/bin/junker : #!/rpm/BUILD/perl-5.6.0-RC2/miniperl -I/rpm/BUILD/perl-5.6.0-RC2/lib : : use File::Copy; : : print "pid is $$\n"; : : copy('/etc/hosts','/home/dfavor/bin/junk.txt'); : dgsp>~/bin/junker : pid is 23330 : fn=4 buffer=20035ED8 offset=0 isize=0 ilen=8 osize=0 olen=1943 : :The fileno is correct, but I'm unsure what I'm seeing for the other values. :It's as if the stack is corrupt and the printf() values are shifted some way. Looks like 'offset' is bigger than you think: try handling as either "%ld" and (long)offset, or "%Ld" and (long long)offset. HugoThread Previous | Thread Next