summaryrefslogtreecommitdiff
path: root/src/logging.cc
diff options
context:
space:
mode:
authorTeddy Reed <teddy@prosauce.org>2015-05-12 23:22:24 -0700
committerTeddy Reed <teddy@prosauce.org>2015-08-10 16:49:33 -0700
commit58438d398fb61fbf96dd496ffa0d4b19d66ae60b (patch)
tree08a75c8fd7bd2a449098f4fff1a2ff26f53f7a1c /src/logging.cc
parent2a02db7aa5f3a832f0d215aeb395d5c218ad8f3e (diff)
downloadglog-58438d398fb61fbf96dd496ffa0d4b19d66ae60b.tar.gz
glog-58438d398fb61fbf96dd496ffa0d4b19d66ae60b.tar.bz2
glog-58438d398fb61fbf96dd496ffa0d4b19d66ae60b.zip
[#23] Add logfile_mode to control logfile permissions
Diffstat (limited to 'src/logging.cc')
-rw-r--r--src/logging.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/logging.cc b/src/logging.cc
index 5543e3a..12bc849 100644
--- a/src/logging.cc
+++ b/src/logging.cc
@@ -161,6 +161,8 @@ static const char* DefaultLogDir() {
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.");
@@ -897,7 +899,7 @@ bool LogFileObject::CreateLogfile(const string& time_pid_string) {
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