You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_dtcl@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2002/01/05 19:41:30 UTC

insidious stat vs stat64 bug on Linux

[ sorry for the crossposting - is everyone who needs to be on general@
? ]

Observe:

FILE 1

#include "httpd.h"
#include <tcl.h>

int main() {
    struct stat foo;
    printf("size of stat __pad1 is %d\n", sizeof(foo.__pad1));
}

FILE 2

#include <tcl.h>
#include "httpd.h"

int main() {
    struct stat foo;
    printf("size of stat __pad1 is %d\n", sizeof(foo.__pad1));
}

These are *different*, because, at least on my box, running Linux
2.4.16 on a PowerPC system, #define _FILE_OFFSET_BITS 64 is set by the
Apache config files.

so the first is really a stat64 struct, and the second a regular old
stat struct.

I'm not sure of all of the ramifications of this, but I spent a long
time even finding it, and think that it might cause some very subtle
and nasty bugs.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/