From: lauras AT softhome DOT net Date: Mon, 8 Jan 2001 10:28:44 +0200 To: Eli Zaretskii Cc: lauras AT softhome DOT net, djgpp-workers AT delorie DOT com, rich AT phekda DOT freeserve DOT co DOT uk Subject: Re: Bug in lstat() - wrong arguments to FSEXT Message-ID: <20010108102844.A219@lauras.lt> References: <20010107141016 DOT A314 AT lauras DOT lt> <20010107155532 DOT A4259 AT lauras DOT lt> <9003-Sun07Jan2001194450+0200-eliz AT is DOT elta DOT co DOT il> <20010107225557 DOT A210 AT lauras DOT lt> <6480-Mon08Jan2001004123+0200-eliz AT is DOT elta DOT co DOT il> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="4Ckj6UjgE2iN1+kY" Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <6480-Mon08Jan2001004123+0200-eliz@is.elta.co.il>; from eliz@is.elta.co.il on Mon, Jan 08, 2001 at 12:41:23AM +0200 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 Precedence: bulk --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Jan 08, 2001 at 12:41:23AM +0200, Eli Zaretskii wrote: > The way it works is that the hook gets a pointer to its first argument > on the stack, and then it walks the stack with va_arg to get the rest. > The same is done in the open hook: it only gets the pointer to the > first argument, but it also needs the open mode. OK. Sorry for asking such trivial questions. Anyway, here is an updated patch. Laurynas --4Ckj6UjgE2iN1+kY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="lstat.c.diff" Index: lstat.c =================================================================== RCS file: /cvs/djgpp/djgpp/src/libc/posix/sys/stat/lstat.c,v retrieving revision 1.3 diff -u -r1.3 lstat.c --- lstat.c 2000/08/25 11:39:49 1.3 +++ lstat.c 2001/01/08 07:41:25 @@ -1,3 +1,4 @@ +/* Copyright (C) 2001 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */ /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */ @@ -872,6 +873,16 @@ return 0; } +/* A wrapper around __FSEXT_call_open_handlers(), to provide its + * arguments properly. + */ +static int fsext_wrapper(int * ret, const char * path, + struct stat * statbuf __attribute__((unused))) +{ + return __FSEXT_call_open_handlers(__FSEXT_stat, ret, &path); +} + + /* Main entry point. This is library lstat() function. */ @@ -907,8 +918,8 @@ return -1; } - if (__FSEXT_call_open_handlers(__FSEXT_stat, &ret, &real_path)) - return ret; + if (fsext_wrapper(&ret, real_path, statbuf)) + return ret; if (stat_assist(real_path, statbuf) == -1) { --4Ckj6UjgE2iN1+kY--