Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
G
glog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
glog
Commits
a94afc68
Commit
a94afc68
authored
Aug 12, 2015
by
Fumitoshi Ukai
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #26 from theopolis/feature-mode-flag
[#23] Add logfile_mode to control logfile permissions
parents
f7691955
58438d39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
logging.h.in
src/glog/logging.h.in
+3
-0
logging.cc
src/logging.cc
+3
-1
No files found.
src/glog/logging.h.in
View file @
a94afc68
...
...
@@ -361,6 +361,9 @@ DECLARE_int32(minloglevel);
// 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);
...
...
src/logging.cc
View file @
a94afc68
...
...
@@ -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."
);
...
...
@@ -899,7 +901,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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment