Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Improved HISTFILE locking



On Sun, Oct 17, 2004 at 10:00:32PM -0700, Wayne Davison wrote:
> Looks like a simple improvement to gettempname() to make it take an
> optional prefix arg will allow us to use that to create a better
> unique filename based on $HISTFILE.  I've attached a patch that
> implements this, fixes an unsafe use of gettempname() in builtin.c,
> and adds a new string function named bicat() that works like dyncat(),
> but uses permanent memory instead of the heap.

I improved a few things in that patch and checked it in.  The
improvements were:

 - In my safety fix in builtin.c, made sure that errno doesn't get
   changed by fdopen() if the open() call failed.

 - In lockhistfile() in hist.c, delayed the fdopen() so that it doesn't
   interfere with the locking logic.

 - In gettempname(), made the logic for adding a separating '.' between
   the prefix and the suffix depend on the presence of a non-NULL
   prefix, not on the setting of the use_heap variable.  (The end result
   is the same, but the function's behavior is more logical.)

..wayne..



Messages sorted by: Reverse Date, Date, Thread, Author