summary refs log tree commit diff
path: root/src/libutil
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2009-12-17 14:12:44 +0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2009-12-17 14:12:44 +0000
commitef92a14bfea7a16102b04711c9c18ad717e82ea1 (patch)
tree8a71b4fac699c3d06a52d20a07f5883d66e66d7c /src/libutil
parent945d8218fbcab4e546213f420125bf521ff3306d (diff)
downloadguix-ef92a14bfea7a16102b04711c9c18ad717e82ea1.tar.gz
* 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.)

Diffstat (limited to 'src/libutil')
-rw-r--r--src/libutil/archive.cc4
-rw-r--r--src/libutil/util.hh2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index f30e5b7cf6..8fde4328c4 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -1,3 +1,5 @@
+#include "config.h"
+
 #include <cerrno>
 #include <algorithm>
 #include <vector>
@@ -12,8 +14,6 @@
 #include "archive.hh"
 #include "util.hh"
 
-#include "config.h"
-
 
 namespace nix {
 
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index d7d3e5edf8..a5d0445c14 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -1,6 +1,8 @@
 #ifndef __UTIL_H
 #define __UTIL_H
 
+#include "config.h"
+
 #include "types.hh"
 
 #include <sys/types.h>