Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Improved HISTFILE locking
- X-seq: zsh-workers 20501
- From: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Improved HISTFILE locking
- Date: Mon, 18 Oct 2004 12:36:25 -0700
- In-reply-to: <20041018050032.GA32556@xxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20041001193658.GD26529@xxxxxxxxx> <20041017194842.GA26158@xxxxxxxxx> <Pine.LNX.4.61.0410171652500.8058@xxxxxxxxxxxxxxxxxx> <20041018050032.GA32556@xxxxxxxxx>
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