From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16677 invoked from network); 18 Oct 2004 19:36:48 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 18 Oct 2004 19:36:48 -0000 Received: (qmail 69186 invoked from network); 18 Oct 2004 19:36:42 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 18 Oct 2004 19:36:42 -0000 Received: (qmail 7499 invoked by alias); 18 Oct 2004 19:36:28 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 20501 Received: (qmail 7485 invoked from network); 18 Oct 2004 19:36:27 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 18 Oct 2004 19:36:27 -0000 Received: (qmail 68885 invoked from network); 18 Oct 2004 19:36:27 -0000 Received: from dsl3-63-249-88-2.cruzio.com (HELO binome.blorf.net) (63.249.88.2) by a.mx.sunsite.dk with SMTP; 18 Oct 2004 19:36:26 -0000 Received: by binome.blorf.net (Postfix, from userid 1000) id 5F9A12A4; Mon, 18 Oct 2004 12:36:25 -0700 (PDT) Date: Mon, 18 Oct 2004 12:36:25 -0700 From: Wayne Davison To: zsh-workers@sunsite.dk Subject: Improved HISTFILE locking Message-ID: <20041018193625.GF10807@blorf.net> References: <20041001193658.GD26529@blorf.net> <20041017194842.GA26158@blorf.net> <20041018050032.GA32556@blorf.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20041018050032.GA32556@blorf.net> User-Agent: Mutt/1.5.6+20040722i X-Spam-Checker-Version: SpamAssassin 2.63 on a.mx.sunsite.dk X-Spam-Level: X-Spam-Status: No, hits=-1.4 required=6.0 tests=BAYES_20 autolearn=no version=2.63 X-Spam-Hits: -1.4 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..