log: add option to set file permissions
This commit is contained in:
@@ -90,6 +90,7 @@ struct tlog_log {
|
||||
time_t last_waitpid;
|
||||
mode_t file_perm;
|
||||
mode_t archive_perm;
|
||||
int mode_changed;
|
||||
|
||||
int waiters;
|
||||
int is_exit;
|
||||
@@ -332,6 +333,7 @@ void tlog_set_permission(struct tlog_log *log, unsigned int file, unsigned int a
|
||||
{
|
||||
log->file_perm = file;
|
||||
log->archive_perm = archive;
|
||||
log->mode_changed = 1;
|
||||
}
|
||||
|
||||
int tlog_localtime(struct tlog_time *tm)
|
||||
@@ -1205,6 +1207,10 @@ static int _tlog_write(struct tlog_log *log, const char *buff, int bufflen)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (log->mode_changed != 0) {
|
||||
fchmod(log->fd, log->file_perm);
|
||||
}
|
||||
|
||||
log->last_try = 0;
|
||||
log->print_errmsg = 1;
|
||||
/* get log file size */
|
||||
|
||||
Reference in New Issue
Block a user