From cd055d95052ff86ec3c934d1ffeaed1e68304f1d Mon Sep 17 00:00:00 2001 From: Peter Teuben Date: Thu, 2 Jan 2025 13:39:57 -0500 Subject: [PATCH] change while() to a for() loop and copydata now works... go figure --- src/kernel/io/filesecret.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/kernel/io/filesecret.c b/src/kernel/io/filesecret.c index d939bd205..19c4d94e6 100644 --- a/src/kernel/io/filesecret.c +++ b/src/kernel/io/filesecret.c @@ -1224,15 +1224,21 @@ local void copydata( char *src, *dat = (char *) vdat; off_t oldpos; - dprintf(0,"COPYDATA: off=%ld len=%ld\n", off, len); - off *= ItemLen(ipt); /* offset bytes from start */ if (ItemDat(ipt) != NULL) { /* data already in core? */ src = (char *) ItemDat(ipt) + off; /* get pointer to source */ len *= ItemLen(ipt); /* number of bytes to copy */ - dprintf(0,"COPYDATA2: len=%ld src=0x%x dat=0x%x\n",len, src, dat); - while (--len >= 0) /* loop copying data */ + // dprintf(0,"COPYDATA2: len=%ld src=0x%x dat=0x%x\n",len, src, dat); +#if 0 + // this while loop will hit through 0, and eventually segfault in the copy + // compiler bug ? + while (--len >= 0) { /* loop copying data */ *dat++ = *src++; /* byte by byte */ + } +#else + for (size_t i=0; i