Figured something out, that I think is the problem...

Looks like the code in dumpstuff does this:

#ifdef AFS_LARGEFILE_ENV
   treat offsets at 64bit
#else
   treat offsets as 32bit
#endif

problem is that it's building where LARGEFILE_ENV is not true, and 
64BIT_ENV is true. 

It needs to be

#ifdef AFS_64BIT_ENV
   treat offsets as 64bit
   #ifdef AFS_LARGEFILE_ENV
      support use of >32bit offset values
   #endif
#else
   treat offsets as 32bit
#endif

Basically, the code is currently written with the assumption that if
your client is 64 bit capable, it will ALWAYS be built with largefile
support. That assumption is not currently correct. 

The attached patch appears to fix the problem with WriteFile in
dumpstuff.c, but there are likely other fixes needed elsewhere.

-- Nathan
Index: dumpstuff.c
===================================================================
RCS file: /cvs/openafs/src/volser/dumpstuff.c,v
retrieving revision 1.12
diff -u -r1.12 dumpstuff.c
--- dumpstuff.c 13 Feb 2003 18:06:10 -0000      1.12
+++ dumpstuff.c 13 Mar 2003 01:41:27 -0000
@@ -1118,29 +1118,29 @@
 
 
     *status = 0;
-#ifdef AFS_LARGEFILE_ENV
+#ifdef AFS_64BIT_ENV
     {
-       afs_uint32 filesize_high, filesize_low;
+       afs_uint32 filesize_high = 0L, filesize_low = 0L;
+#ifdef AFS_LARGEFILE_ENV
        if (tag == 'h') {
            if (!ReadInt32(iodp, &filesize_high) ) {
                *status = 1;
                return(0);
            }
-       } else {
-           filesize_high = 0L;
        }
+#endif
        if (!ReadInt32(iodp, &filesize_low)) {
            *status = 1;
            return(0);
        }
        FillInt64(filesize, filesize_high, filesize_low);
     }
-#else /* !AFS_LARGEFILE_ENV */
+#else /* !AFS_64BIT_ENV */
     if (!ReadInt32(iodp, &filesize)) {
         *status = 1;
        return(0);
     }
-#endif /* !AFS_LARGEFILE_ENV */
+#endif /* !AFS_64BIT_ENV */
     p = (unsigned char *) malloc(size);
     if (p == NULL) {
         *status = 2;
@@ -1151,7 +1151,7 @@
            size = nbytes;
        
        if ((code = iod_Read(iodp, p, size)) != size) {
-#ifdef AFS_LARGEFILE_ENV
+#ifdef AFS_64BIT_ENV
            Log("1 Volser: WriteFile: Error reading dump file %d size=(0X%x,0X%x) 
nbytes=%d (%d of %d); restore aborted\n", vn,
                (unsigned) (filesize >> 32),
                (unsigned) (filesize & 0xffffffff),

Reply via email to