Skip to content

Commit

Permalink
Merge pull request #376 from vgough/osx
Browse files Browse the repository at this point in the history
Special case FDATASYNC check on Apple
  • Loading branch information
vgough authored Aug 8, 2017
2 parents d820f70 + a8eebf3 commit 1eb9360
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 8 deletions.
12 changes: 10 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,26 @@ language: cpp

sudo: true

os:
- linux
- osx

compiler:
- clang
- gcc

matrix:
exclude:
- os: osx
compiler: gcc

branches:
only:
- master
- travis

before_script:
- sudo modprobe fuse
- cmake --version
- ./ci/setup.sh

script:
- ./ci/check.sh
Expand Down
7 changes: 6 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ check_cxx_source_compiles ("#include <sys/types.h>
include (CheckFuncs)
check_function_exists_glibc (lchmod HAVE_LCHMOD)
check_function_exists_glibc (utimensat HAVE_UTIMENSAT)
check_function_exists_glibc (fdatasync HAVE_FDATASYNC)
if (APPLE)
message ("-- There is no usable FDATASYNC on Apple")
set(HAVE_FDATASYNC FALSE)
else()
check_function_exists_glibc (fdatasync HAVE_FDATASYNC)
endif (APPLE)

set (CMAKE_THREAD_PREFER_PTHREAD)
find_package (Threads REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ ! -d build ]]
then
mkdir build
cd build
cmake ..
cmake .. $*
cd ..
fi

Expand Down
11 changes: 9 additions & 2 deletions ci/check.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#!/bin/bash -eu

cmake --version

CFG=""
if [ "$TRAVIS_OS_NAME" = "osx" ]; then
CFG="-DENABLE_NLS=OFF -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl"
fi

if [[ ! -d build ]]
then
mkdir build
mkdir build
fi

cd build
cmake ..
cmake .. ${CFG}
make -j2
make test

Expand Down
10 changes: 10 additions & 0 deletions ci/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -eu

if [ "$TRAVIS_OS_NAME" == "linux" ]; then
sudo modprobe fuse
fi

if [ "$TRAVIS_OS_NAME" == "osx" ]; then
brew cask install osxfuse
fi

2 changes: 1 addition & 1 deletion encfs/FileNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ int FileNode::sync(bool datasync) {
int fh = io->open(O_RDONLY);
if (fh >= 0) {
int res = -EIO;
#ifdef linux
#if defined(HAVE_FDATASYNC)
if (datasync) {
res = fdatasync(fh);
} else {
Expand Down
2 changes: 1 addition & 1 deletion encfs/FileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ RootPtr createV6Config(EncFS_Context *ctx,
alg = findCipherAlgorithm("AES", keySize);

// If case-insensitive system, opt for Block32 filename encoding
#if DEFAULT_CASE_INSENSITIVE
#if defined(DEFAULT_CASE_INSENSITIVE)
nameIOIface = BlockNameIO::CurrentInterface(true);
#else
nameIOIface = BlockNameIO::CurrentInterface();
Expand Down

0 comments on commit 1eb9360

Please sign in to comment.