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 34372
- 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 22:56:56 +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=WQmn/iq0UoCR40JkbZyganxj6rnq5WDCQE0QUpqIzIg=; b=VpFar5wfE370SRb7vtgNK0xPxLqTvS9IiByt1yIBWnK82Be+vhuruChvLXD9UvGRbf YH8m5KnA4kL/9rPyVRfpjtqCANju1UlqWPjFPbd9Ttenk4rMoOaBIJYcT9yVD112lJ8U 0D+Iau/FshVXlF0UcyeNQ2JFK274FGZvJfDXupxg4Y7JHtyYMzLrhKpJUvv6cCDjaQjl Xcw70t5TjNArpxqgjdMf8MuICChuB4K6QLl1heIBbROdogMsVtYophWSVK4RqUSN7Ok4 8PSsCd/E0AfQoDnP2yIL9KoKOG+ubzCOZlMTye3pmxXPm/pWaG12v3w0nlzfqUbhOC5I tB1A==
- In-reply-to: <CAHYJk3Qey1gXZ=8d1_FZbYQ2pFd2DHS_eZ-ceP5=JoaOyB+-6A@mail.gmail.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> <CAHYJk3Qey1gXZ=8d1_FZbYQ2pFd2DHS_eZ-ceP5=JoaOyB+-6A@mail.gmail.com>
On Sat, Jan 24, 2015 at 8:09 PM, Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> 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?
At this point, just assume I mean coverity if I ever mention valgrind.
I don't know why this happens...
--
Mikael Magnusson
Messages sorted by:
Reverse Date,
Date,
Thread,
Author