Fix memory access on 32-bit linux.

The reason for random read failures is that these defines
are only effective if they are placed before any system
headers, especially sys/types.h; in the old version they
didn't work, and pread was expecting a signed 32-bit offset.
develop
Alexander Gavrilov 2011-04-09 22:54:45 +04:00
parent 4a83f07bdd
commit b5d086ac02
1 changed files with 5 additions and 2 deletions

@ -34,6 +34,11 @@ distribution.
#define _QUOTEME(x) #x
#define QUOT(x) _QUOTEME(x)
#ifdef LINUX_BUILD
#define __USE_FILE_OFFSET64
#define _FILE_OFFSET_BITS 64
#endif
// one file for globals
#include "dfhack/DFGlobal.h"
@ -60,8 +65,6 @@ using namespace std;
#include <sys/types.h>
#include <sys/ptrace.h>
#include <dirent.h>
#define __USE_FILE_OFFSET64
#define _FILE_OFFSET_BITS 64
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>