Re: log files and permissions
Martin Pihlak <martin.pihlak@gmail.com>
From: Martin Pihlak <martin.pihlak@gmail.com>
To: Itagaki Takahiro <itagaki.takahiro@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2010-07-12T10:36:37Z
Lists: pgsql-hackers
Attachments
- log-file-mode.patch (text/x-diff) patch
Itagaki Takahiro wrote: > I checked "log_file_mode GUC" patch, and found a couple of Windows-specific > and translation issues. Thank you for the review. Attached patch attempts to fix these issues. > * fchmod() is not available on some platforms, including Windows. > fh = fopen(filename, mode); > setvbuf(fh, NULL, LBF_MODE, 0); > fchmod(fileno(fh), Log_file_mode); > I've changed that to using chmod(), that should be available everywhere and is already used in several places in Postgres code. > * How does the file mode work on Windows? > If it doesn't work, we should explain it in docs. Indeed it seems that chmod() doesn't actually do anything useful on Windows. So I've added a documentation note about it and put an #ifndef WIN32 around the chmod() call. > It might look a duplication of codes, but I think this form is better > because we can reuse the existing translation catalogs. > if (am_rotating) > ereport(FATAL, ... "could not create log file ...); > else > ereport(LOG, ... "could not open new log file ...); > Fixed. regards, Martin