From: Mikael Magnusson <mikachu@gmail.com>
To: Peter Stephenson <p.w.stephenson@ntlworld.com>
Cc: zsh workers <zsh-workers@zsh.org>
Subject: Re: 'cd' built-in crashed zsh on a broken file system
Date: Sat, 24 Jan 2015 20:09:14 +0100 [thread overview]
Message-ID: <CAHYJk3Qey1gXZ=8d1_FZbYQ2pFd2DHS_eZ-ceP5=JoaOyB+-6A@mail.gmail.com> (raw)
In-Reply-To: <20150120203436.4bf346a4@ntlworld.com>
On Tue, Jan 20, 2015 at 9:34 PM, Peter Stephenson
<p.w.stephenson@ntlworld.com> 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
next prev parent reply other threads:[~2015-01-24 19:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 12:35 Kamil Dudka
2015-01-20 18:28 ` Bart Schaefer
2015-01-20 20:34 ` Peter Stephenson
2015-01-20 21:57 ` Bart Schaefer
2015-01-23 13:31 ` Kamil Dudka
2015-01-24 19:09 ` Mikael Magnusson [this message]
2015-01-24 21:56 ` Mikael Magnusson
2015-01-25 3:54 ` Bart Schaefer
2015-01-25 17:54 ` 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='CAHYJk3Qey1gXZ=8d1_FZbYQ2pFd2DHS_eZ-ceP5=JoaOyB+-6A@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=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).