forked from lix-project/lix
Merge pull request #685 from vizanto/master
POSIX compliant directory access (fixes build on Solaris)
This commit is contained in:
commit
6298afc047
|
@ -48,6 +48,7 @@ test "$localstatedir" = '${prefix}/var' && localstatedir=/nix/var
|
|||
|
||||
|
||||
# Solaris-specific stuff.
|
||||
AC_STRUCT_DIRENT_D_TYPE
|
||||
if test "$sys_name" = sunos; then
|
||||
# Solaris requires -lsocket -lnsl for network functions
|
||||
LIBS="-lsocket -lnsl $LIBS"
|
||||
|
|
|
@ -232,7 +232,7 @@ DirEntries readDirectory(const Path & path)
|
|||
checkInterrupt();
|
||||
string name = dirent->d_name;
|
||||
if (name == "." || name == "..") continue;
|
||||
entries.emplace_back(name, dirent->d_ino, dirent->d_type);
|
||||
entries.emplace_back(name, dirent->d_ino, #ifdef HAVE_STRUCT_DIRENT_D_TYPE dirent->d_type #else DT_UNKNOWN #endif);
|
||||
}
|
||||
if (errno) throw SysError(format("reading directory ‘%1%’") % path);
|
||||
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
|
||||
#include <cstdio>
|
||||
|
||||
#ifndef HAVE_STRUCT_DIRENT_D_TYPE
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_REG 1
|
||||
#define DT_LNK 2
|
||||
#define DT_DIR 3
|
||||
#endif
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
|
Loading…
Reference in a new issue