[utilities COMMIT] in /cpp-log4shib/trunk/src: FileAppender.cpp RemoteSyslogAppender.cpp RollingFileAppender.cpp
noreply at shibboleth.net
noreply at shibboleth.net
Wed May 29 16:15:42 EDT 2013
Author: scantor
Date: Wed May 29 16:15:42 2013
New Revision: 407
URL: http://svn.shibboleth.net/view/utilities?rev=407&view=rev
Log:
Need to prefix HAVE_ macros in the code
Modified:
cpp-log4shib/trunk/src/FileAppender.cpp
cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp
cpp-log4shib/trunk/src/RollingFileAppender.cpp
Modified: cpp-log4shib/trunk/src/FileAppender.cpp
URL: http://svn.shibboleth.net/view/utilities/cpp-log4shib/trunk/src/FileAppender.cpp?rev=407&r1=406&r2=407&view=diff
==============================================================================
--- cpp-log4shib/trunk/src/FileAppender.cpp (original)
+++ cpp-log4shib/trunk/src/FileAppender.cpp Wed May 29 16:15:42 2013
@@ -33,13 +33,13 @@
_mode(mode) {
if (!append)
_flags |= O_TRUNC;
-#ifdef HAVE_O_CLOEXEC
+#ifdef LOG4SHIB_HAVE_O_CLOEXEC
_flags |= O_CLOEXEC;
#endif
_fd = ::open(_fileName.c_str(), _flags, _mode);
if (_fd == -1)
throw std::runtime_error(std::string("failed to open log file (") + _fileName + ')');
-#if !defined(HAVE_O_CLOEXEC) && defined(HAVE_FD_CLOEXEC)
+#if !defined(LOG4SHIB_HAVE_O_CLOEXEC) && defined(LOG4SHIB_HAVE_FD_CLOEXEC)
int fdflags = ::fcntl(_fd, F_GETFD);
if (fdflags != -1) {
fdflags |= FD_CLOEXEC;
@@ -54,8 +54,15 @@
_fd(fd),
_flags(O_CREAT | O_APPEND | O_WRONLY),
_mode(00644) {
-#ifdef HAVE_O_CLOEXEC
+#ifdef LOG4SHIB_HAVE_O_CLOEXEC
_flags |= O_CLOEXEC;
+#endif
+#if !defined(LOG4SHIB_HAVE_O_CLOEXEC) && defined(LOG4SHIB_HAVE_FD_CLOEXEC)
+ int fdflags = ::fcntl(_fd, F_GETFD);
+ if (fdflags != -1) {
+ fdflags |= FD_CLOEXEC;
+ ::fcntl(_fd, F_SETFD, fdflags);
+ }
#endif
}
@@ -108,7 +115,7 @@
if (_fd != -1)
::close(_fd);
_fd = fd;
-#if !defined(HAVE_O_CLOEXEC) && defined(HAVE_FD_CLOEXEC)
+#if !defined(LOG4SHIB_HAVE_O_CLOEXEC) && defined(LOG4SHIB_HAVE_FD_CLOEXEC)
int fdflags = ::fcntl(_fd, F_GETFD);
if (fdflags != -1) {
fdflags |= FD_CLOEXEC;
Modified: cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp
URL: http://svn.shibboleth.net/view/utilities/cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp?rev=407&r1=406&r2=407&view=diff
==============================================================================
--- cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp (original)
+++ cpp-log4shib/trunk/src/RemoteSyslogAppender.cpp Wed May 29 16:15:42 2013
@@ -115,14 +115,14 @@
// Get a datagram socket.
int type = SOCK_DGRAM;
-#ifdef HAVE_SOCK_CLOEXEC
+#ifdef LOG4SHIB_HAVE_SOCK_CLOEXEC
type |= SOCK_CLOEXEC;
#endif
if ((_socket = socket(AF_INET, type, 0)) < 0) {
// loglog("RemoteSyslogAppender: failed to open socket");
return; // fail silently
}
-#if !defined(HAVE_SOCK_CLOEXEC) && defined(HAVE_FD_CLOEXEC)
+#if !defined(LOG4SHIB_HAVE_SOCK_CLOEXEC) && defined(LOG4SHIB_HAVE_FD_CLOEXEC)
int fdflags = ::fcntl(_socket, F_GETFD);
if (fdflags != -1) {
fdflags |= FD_CLOEXEC;
Modified: cpp-log4shib/trunk/src/RollingFileAppender.cpp
URL: http://svn.shibboleth.net/view/utilities/cpp-log4shib/trunk/src/RollingFileAppender.cpp?rev=407&r1=406&r2=407&view=diff
==============================================================================
--- cpp-log4shib/trunk/src/RollingFileAppender.cpp (original)
+++ cpp-log4shib/trunk/src/RollingFileAppender.cpp Wed May 29 16:15:42 2013
@@ -73,7 +73,7 @@
::rename(_fileName.c_str(), oldName.str().c_str());
}
_fd = ::open(_fileName.c_str(), _flags, _mode);
-#if !defined(HAVE_O_CLOEXEC) && defined(HAVE_FD_CLOEXEC)
+#if !defined(LOG4SHIB_HAVE_O_CLOEXEC) && defined(LOG4SHIB_HAVE_FD_CLOEXEC)
int fdflags = ::fcntl(_fd, F_GETFD);
if (fdflags != -1) {
fdflags |= FD_CLOEXEC;
More information about the commits
mailing list