Blob Blame History Raw
From f5d37d2c6581e874c8d4aedfe8a09339b3f8b03d Mon Sep 17 00:00:00 2001
From: Jakob Unterwurzacher <jakobunt@gmail.com>
Date: Sun, 1 Oct 2017 19:04:30 +0200
Subject: [PATCH] Replace "linux" define with more-standard "__linux__"

The "linux" define is not available with "g++ -std=c++11",
which resulted in bug https://github.com/vgough/encfs/issues/398 .

Available defines for gcc 7.1.1, g++ 7.1.7, clang 4.0.0:

$ g++ -dM -E -x c++ /dev/null | grep linux

$ g++ -dM -E -x c++ -std=c++11 /dev/null | grep linux

$ echo "" | gcc -E -dM -c - | grep linux

$ echo "" | clang -E - -dM | grep linux
---
 encfs/DirNode.cpp   | 2 +-
 encfs/FileNode.cpp  | 2 +-
 encfs/FileUtils.cpp | 2 +-
 encfs/RawFileIO.cpp | 2 +-
 encfs/encfs.cpp     | 2 +-
 encfs/encfs.h       | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/encfs/DirNode.cpp b/encfs/DirNode.cpp
index 8dc3335..00b60bf 100644
--- a/encfs/DirNode.cpp
+++ b/encfs/DirNode.cpp
@@ -31,7 +31,7 @@
 #include "FileNode.h"
 #include "FileUtils.h"
 #include "NameIO.h"
-#ifdef linux
+#ifdef __linux__
 #include <sys/fsuid.h>
 #endif
 
diff --git a/encfs/FileNode.cpp b/encfs/FileNode.cpp
index 7486720..64ae8af 100644
--- a/encfs/FileNode.cpp
+++ b/encfs/FileNode.cpp
@@ -24,7 +24,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-#ifdef linux
+#ifdef __linux__
 #include <sys/fsuid.h>
 #endif
 
diff --git a/encfs/FileUtils.cpp b/encfs/FileUtils.cpp
index 444b2e8..c477786 100644
--- a/encfs/FileUtils.cpp
+++ b/encfs/FileUtils.cpp
@@ -19,7 +19,7 @@
  */
 
 // defines needed for RedHat 7.3...
-#ifdef linux
+#ifdef __linux__
 #define _XOPEN_SOURCE 500  // make sure pwrite() is pulled in
 #endif
 #define _BSD_SOURCE      // pick up setenv on RH7.3
diff --git a/encfs/RawFileIO.cpp b/encfs/RawFileIO.cpp
index 6f722c9..7cab3dd 100644
--- a/encfs/RawFileIO.cpp
+++ b/encfs/RawFileIO.cpp
@@ -18,7 +18,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifdef linux
+#ifdef __linux__
 #define _XOPEN_SOURCE 500  // pick up pread , pwrite
 #endif
 #include "easylogging++.h"
diff --git a/encfs/encfs.cpp b/encfs/encfs.cpp
index 721c28a..99fad32 100644
--- a/encfs/encfs.cpp
+++ b/encfs/encfs.cpp
@@ -32,7 +32,7 @@
 #include <sys/time.h>
 #include <unistd.h>
 #include <utime.h>
-#ifdef linux
+#ifdef __linux__
 #include <sys/fsuid.h>
 #endif
 
diff --git a/encfs/encfs.h b/encfs/encfs.h
index 0d6b7d1..28b7709 100644
--- a/encfs/encfs.h
+++ b/encfs/encfs.h
@@ -34,7 +34,7 @@ namespace encfs {
 #define HAVE_XATTR
 #endif
 
-#ifndef linux
+#ifndef __linux__
 #include <cerrno>
 
 static __inline int setfsuid(uid_t uid) {
-- 
2.13.6