delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2001/01/07/07:21:58

Date: Sun, 7 Jan 2001 14:20:14 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: lauras AT softhome DOT net
cc: djgpp-workers AT delorie DOT com, Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk>
Subject: Re: Bug in lstat() - wrong arguments to FSEXT
In-Reply-To: <20010107141016.A314@lauras.lt>
Message-ID: <Pine.SUN.3.91.1010107141348.25836D-100000@is>
MIME-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Sun, 7 Jan 2001 lauras AT softhome DOT net wrote:

> On Sun, Jan 07, 2001 at 12:08:27PM +0200, Eli Zaretskii wrote:
> > I think this is a result of replacing `path' with `real_path' when 
> > symlink support was added to `stat': the former was on the stack, since 
> > it's the argument of `stat' (now `lstat'), and so passing a pointer to 
> > it does TRT, evebn though it is not declared as a va_list.
> 
> But the converted path is on the stack too, it's a local and
> not static variable, so shouldn't it work too?

Sorry, I wasn't being clear.

This will only work if `path' is on the stack with the other arguments 
passed to `stat', because the FSEXT hook expects to find the same 
argument list on its stack when it is called.  `path' satisfies this 
requirement, because it is `stat's argument.  But `real_path' is a local 
variable inside `stat' (now `lstat'), so it is further down the stack, 
far from the struct stat buffer which sits near `path' on the stack.

If this is still unclear, draw the stack layout upon call to `stat' and 
when the FSEXT hook is called, look at how va_arg walks the stack, and
I'm sure you will understand.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019