Index: make-bsd.mk --- make-bsd.mk.orig 2018-04-27 22:52:33.000000000 +0200 +++ make-bsd.mk 2018-04-28 09:48:03.566463000 +0200 @@ -21,10 +21,10 @@ # C25519 in particular is almost UNUSABLE in heavy testing without it. node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CFLAGS = -Wall -O2 -g -pthread $(INCLUDES) $(DEFS) else - CFLAGS?=-O3 -fstack-protector - CFLAGS+=-Wall -fPIE -fvisibility=hidden -fstack-protector -pthread $(INCLUDES) -DNDEBUG $(DEFS) - LDFLAGS+=-pie -Wl,-z,relro,-z,now - STRIP=strip --strip-all + CFLAGS?=-O2 + CFLAGS+=-fvisibility=hidden -pthread $(INCLUDES) -DNDEBUG $(DEFS) + LDFLAGS+= + STRIP=true endif ifeq ($(ZT_TRACE),1) Index: make-linux.mk --- make-linux.mk.orig 2018-04-28 09:46:52.384474000 +0200 +++ make-linux.mk 2018-04-28 09:47:42.084376000 +0200 @@ -71,11 +71,11 @@ # C25519 in particular is almost UNUSABLE in -O0 even on a 3ghz box! node/Salsa20.o node/SHA512.o node/C25519.o node/Poly1305.o: CXXFLAGS=-Wall -O2 -g -pthread $(INCLUDES) $(DEFS) else - CFLAGS?=-O3 -fstack-protector -fPIE - override CFLAGS+=-Wall -Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS) - CXXFLAGS?=-O3 -fstack-protector -fPIE - override CXXFLAGS+=-Wall -Wno-deprecated -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS) - LDFLAGS=-pie -Wl,-z,relro,-z,now + CFLAGS?=-O2 + override CFLAGS+=-Wno-deprecated -pthread $(INCLUDES) -DNDEBUG $(DEFS) + CXXFLAGS?=-O2 + override CXXFLAGS+=-Wno-deprecated -std=c++11 -pthread $(INCLUDES) -DNDEBUG $(DEFS) + LDFLAGS= STRIP?=strip STRIP+=--strip-all endif Index: osdep/OSUtils.cpp --- osdep/OSUtils.cpp.orig 2018-04-27 22:52:33.000000000 +0200 +++ osdep/OSUtils.cpp 2018-04-28 09:46:52.384901000 +0200 @@ -380,56 +380,7 @@ std::string OSUtils::platformDefaultHomePath() { -#ifdef __QNAP__ - char *cmd = "/sbin/getcfg zerotier Install_Path -f /etc/config/qpkg.conf"; - char buf[128]; - FILE *fp; - if ((fp = popen(cmd, "r")) == NULL) { - printf("Error opening pipe!\n"); - return NULL; - } - while (fgets(buf, 128, fp) != NULL) { } - if(pclose(fp)) { - printf("Command not found or exited with error status\n"); - return NULL; - } - std::string homeDir = std::string(buf); - homeDir.erase(std::remove(homeDir.begin(), homeDir.end(), '\n'), homeDir.end()); - return homeDir; -#endif - -#ifdef __UNIX_LIKE__ - -#ifdef __APPLE__ - // /Library/... on Apple - return std::string("/Library/Application Support/ZeroTier/One"); -#else - -#ifdef __BSD__ - // BSD likes /var/db instead of /var/lib - return std::string("/var/db/zerotier-one"); -#else - // Use /var/lib for Linux and other *nix - return std::string("/var/lib/zerotier-one"); -#endif - -#endif - -#else // not __UNIX_LIKE__ - -#ifdef __WINDOWS__ - // Look up app data folder on Windows, e.g. C:\ProgramData\... - char buf[16384]; - if (SUCCEEDED(SHGetFolderPathA(NULL,CSIDL_COMMON_APPDATA,NULL,0,buf))) - return (std::string(buf) + "\\ZeroTier\\One"); - else return std::string("C:\\ZeroTier\\One"); -#else - - return (std::string(ZT_PATH_SEPARATOR_S) + "ZeroTier" + ZT_PATH_SEPARATOR_S + "One"); // UNKNOWN PLATFORM - -#endif - -#endif // __UNIX_LIKE__ or not... + return std::string("@l_prefix@/var/zerotier/db"); } // Inline these massive JSON operations in one place only to reduce binary footprint and compile time