This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: mintty --log overwrites existing logfile in place


Csaba Raduly wrote:
On Fri, Aug 5, 2011 at 10:38 PM, Andy Koppe wrote:
On 4 August 2011 10:57, Christian Franke wrote:
The mintty --log option is very useful but opens logfile without O_TRUNC
or O_APPEND:
(snip)
I would suggest to add O_APPEND.
I'll ponder that. The original intention was O_TRUNC.

Ideally it could be made user-selectable.

Agree, e.g. "--log +FILE" appends to FILE:


client.c:
  // Open log file if any
  if (*cfg.log) {
    if (cfg.log[0] == '+' && cfg.log[1])
      log_fd = open(cfg.log+1, O_WRONLY | O_CREAT | O_APPEND, 0600);
    else
      log_fd = open(cfg.log, O_WRONLY | O_CREAT | O_TRUNC, 0600);
    if (log_fd < 0)
      error("open log file");
  }

Thanks,
Christian


-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]