Merge pull request #47 from sergiud/master

Allow to disable multithreading support using CMake
diff --git a/AUTHORS b/AUTHORS
index 3adbe3a..72959a0 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -15,3 +15,4 @@
 romange <romange@users.noreply.github.com>
 Sergiu Dotenco <sergiu.dotenco@th-nuernberg.de>
 tbennun <tbennun@gmail.com>
+Teddy Reed <teddy@prosauce.org>
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index df7c950..fa9336f 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -32,3 +32,4 @@
 Sergiu Dotenco <sergiu.dotenco@th-nuernberg.de>
 Shinichiro Hamaji <hamaji@google.com>
 tbennun <tbennun@gmail.com>
+Teddy Reed <teddy@prosauce.org>
diff --git a/src/glog/logging.h.in b/src/glog/logging.h.in
index d1ac52b..455bd28 100644
--- a/src/glog/logging.h.in
+++ b/src/glog/logging.h.in
@@ -361,6 +361,9 @@
 // default logging directory.
 DECLARE_string(log_dir);
 
+// Set the log file mode.
+DECLARE_int32(logfile_mode);
+
 // Sets the path of the directory into which to put additional links
 // to the log files.
 DECLARE_string(log_link);
diff --git a/src/logging.cc b/src/logging.cc
index 8936fe3..b7c2f4c 100644
--- a/src/logging.cc
+++ b/src/logging.cc
@@ -161,6 +161,8 @@
   return "";
 }
 
+GLOG_DEFINE_int32(logfile_mode, 0664, "Log file mode/permissions.");
+
 GLOG_DEFINE_string(log_dir, DefaultLogDir(),
                    "If specified, logfiles are written into this directory instead "
                    "of the default logging directory.");
@@ -899,7 +901,7 @@
   string string_filename = base_filename_+filename_extension_+
                            time_pid_string;
   const char* filename = string_filename.c_str();
-  int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, 0664);
+  int fd = open(filename, O_WRONLY | O_CREAT | O_EXCL, FLAGS_logfile_mode);
   if (fd == -1) return false;
 #ifdef HAVE_FCNTL
   // Mark the file close-on-exec. We don't really care if this fails