Skip to content

Commit d269f03

Browse files
committed
Standardize log file create mode to 0640
refs: lxc#4588 Signed-off-by: Randy Syring <randy@syrings.us>
1 parent 48b1e82 commit d269f03

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/lxc/log.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -525,10 +525,10 @@ static int log_open(const char *name)
525525
__do_close int fd = -EBADF;
526526

527527
#ifndef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION
528-
fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0660));
528+
fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0640));
529529
#else
530530
if (!RUN_ON_OSS_FUZZ && is_in_comm("fuzz-lxc-") <= 0)
531-
fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0660));
531+
fd = lxc_unpriv(open(name, O_CREAT | O_WRONLY | O_APPEND | O_CLOEXEC, 0640));
532532
#endif /* !FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION */
533533
if (fd < 0)
534534
return log_error_errno(-errno, errno, "Failed to open log file \"%s\"", name);

src/lxc/terminal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ int lxc_terminal_create_log_file(struct lxc_terminal *terminal)
869869
if (!terminal->log_path)
870870
return 0;
871871

872-
terminal->log_fd = lxc_unpriv(open(terminal->log_path, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0600));
872+
terminal->log_fd = lxc_unpriv(open(terminal->log_path, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0640));
873873
if (terminal->log_fd < 0) {
874874
SYSERROR("Failed to open terminal log file \"%s\"", terminal->log_path);
875875
return -1;

src/lxc/tools/lxc_attach.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ static int lxc_attach_create_log_file(const char *log_file)
308308
{
309309
int fd;
310310

311-
fd = open(log_file, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0600);
311+
fd = open(log_file, O_CLOEXEC | O_RDWR | O_CREAT | O_APPEND, 0640);
312312
if (fd < 0) {
313313
ERROR("Failed to open log file \"%s\"", log_file);
314314
return -1;

0 commit comments

Comments
 (0)