* Include config.h before the C library headers, because it defines

_FILE_OFFSET_BITS=64.  Without it, functions like stat() fail on
  large file sizes.  This happened with a Nix store on squashfs:

  $ nix-store --dump /tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds > /dev/null
  error: getting attributes of path `/tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds': Value too large for defined data type

  $ stat /tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds
  File: `/tmp/mnt/46wzqnk4cbdwh1dclhrpqnnz1icak6n7-local-net-cmds'
  Size: 0               Blocks: 36028797018963968 IO Block: 1024   regular empty file

  (This is a bug in squashfs or mksquashfs, but it shouldn't cause Nix
  to fail.)
This commit is contained in:
Eelco Dolstra 2009-12-17 14:12:44 +00:00
parent 945d8218fb
commit ef92a14bfe
3 changed files with 6 additions and 4 deletions

View file

@ -1,3 +1,5 @@
#include "config.h"
#include "references.hh" #include "references.hh"
#include "pathlocks.hh" #include "pathlocks.hh"
#include "misc.hh" #include "misc.hh"
@ -29,8 +31,6 @@
/* Includes required for chroot support. */ /* Includes required for chroot support. */
#include "config.h"
#if HAVE_SYS_PARAM_H #if HAVE_SYS_PARAM_H
#include <sys/param.h> #include <sys/param.h>
#endif #endif

View file

@ -1,3 +1,5 @@
#include "config.h"
#include <cerrno> #include <cerrno>
#include <algorithm> #include <algorithm>
#include <vector> #include <vector>
@ -12,8 +14,6 @@
#include "archive.hh" #include "archive.hh"
#include "util.hh" #include "util.hh"
#include "config.h"
namespace nix { namespace nix {

View file

@ -1,6 +1,8 @@
#ifndef __UTIL_H #ifndef __UTIL_H
#define __UTIL_H #define __UTIL_H
#include "config.h"
#include "types.hh" #include "types.hh"
#include <sys/types.h> #include <sys/types.h>