zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers@zsh.org
Subject: Re: coredump completing scp
Date: Sat, 29 Jan 2011 23:33:58 +0000	[thread overview]
Message-ID: <20110129233358.0e33fee1@pws-pc.ntlworld.com> (raw)
In-Reply-To: <110129151306.ZM7899@torch.brasslantern.com>

On Sat, 29 Jan 2011 15:13:06 -0800
Bart Schaefer <schaefer@brasslantern.com> wrote:
> This sure seems like a bug in setpwent(), but I'll note that we're making
> a call to setpwent() before ever calling getpwent() in the first place.
> The doc says:
> 
>    The setpwent() function effectively rewinds the user database to allow
>    repeated searches.
> 
> It may be that setpwent() assumes that getpwent() has allocated something
> that it needs to free, something which never has been allocated because
> getpwent() has never been called?  And that only the zsh-mem free() has
> a problem with this?

Right, and since we always call endpwent() after all uses of getpwent(),
we're guaranteed not to need setpwent() at all, aren't we?  My reading
is certainly that after endpwent() you're guaranteed to get the whole
thing from scratch next time, which is all we need.

--- ../zsh-git/zsh/Src/hashtable.c	2010-03-25 21:01:19.000000000 +0000
+++ Src/hashtable.c	2011-01-29 23:28:25.000000000 +0000
@@ -1339,8 +1339,6 @@ fillnameddirtable(UNUSED(HashTable ht))
 #ifdef HAVE_GETPWENT
 	    struct passwd *pw;
  
-	    setpwent();
- 
 	    /* loop through the password file/database *
 	     * and add all entries returned.           */
 	    while ((pw = getpwent()) && !errflag)
@@ -1379,8 +1377,6 @@ fillnameddirtable(UNUSED(HashTable ht))
 #ifdef USE_GETPWENT
 	struct passwd *pw;
  
-	setpwent();
- 
 	/* loop through the password file/database *
 	 * and add all entries returned.           */
 	while ((pw = getpwent()) && !errflag)

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2011-01-29 23:34 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-28  3:13 Vin Shelton
2011-01-28  3:30 ` Bart Schaefer
2011-01-28  3:46   ` Vin Shelton
2011-01-28  9:56   ` Peter Stephenson
2011-01-28 10:14     ` Peter Stephenson
2011-01-29  1:42     ` Vin Shelton
2011-01-29 22:16       ` Peter Stephenson
2011-01-29 23:13         ` Bart Schaefer
2011-01-29 23:33           ` Peter Stephenson [this message]
2011-01-30  5:51             ` Bart Schaefer
2011-02-15 19:02               ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110129233358.0e33fee1@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).