Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: 'cd' built-in crashed zsh on a broken file system
- X-seq: zsh-workers 34371
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
- Subject: Re: 'cd' built-in crashed zsh on a broken file system
- Date: Sat, 24 Jan 2015 20:09:14 +0100
- Cc: zsh workers <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=YJ/KclaeshrGzr7qc0J9l5EhNAvsQplblvhi18PPgng=; b=vXUbKQ+I9NNiQKdYhauM9Kqdp/Lam/8dttDsy8ct+7L2o0Zif6ixJsvTsomT6shf6M fllgneqCRKeqi/wLaEKXFW3a0lmaCTfSHJ2gRImULGqUNktFz0bpJ49oPT6hBvta26/i xfUMzMn9c03JDNzO3fOEvqnx0oe5BgrrdzLQvXmhzbxhdaPMj0cSf8UMuiUOsjg0dOD4 FlpQ9PLVNN7rP9mqB7qeV4oB6G/ddb7opzKQgeHpFQO5Jw7e4Fi8yE0y+aMibtmXN4aC YW2rqHMXoqBVeL/UVs+t31lVW4Yme5+kyZSDyodaczN02Dlg8/pH+vemf69FmkLcv45d 3I8A==
- In-reply-to: <20150120203436.4bf346a4@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <1874234.7FAblKt7ne@kdudka.brq.redhat.com> <150120102810.ZM28542@torch.brasslantern.com> <20150120203436.4bf346a4@ntlworld.com>
On Tue, Jan 20, 2015 at 9:34 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
>
> How about this?
>
> diff --git a/Src/utils.c b/Src/utils.c
> index 4561b5e..cf18f12 100644
> --- a/Src/utils.c
> +++ b/Src/utils.c
> @@ -1108,10 +1108,13 @@ getnameddir(char *name)
> if ((pw = getpwnam(name))) {
> char *dir = isset(CHASELINKS) ? xsymlink(pw->pw_dir)
> : ztrdup(pw->pw_dir);
> - adduserdir(name, dir, ND_USERNAME, 1);
> - str = dupstring(dir);
> - zsfree(dir);
> - return str;
> + if (dir) {
> + adduserdir(name, dir, ND_USERNAME, 1);
> + str = dupstring(dir);
> + zsfree(dir);
> + return str;
> + } else
> + return ztrdup(pw->pw_dir);
This ztrdup triggered a couple of errors in valgrind. Since everything
else returned from getnameddir seems to be heap allocated, should this
be dupstring instead?
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author