delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/17/10:22:44

Date: Thu, 17 Aug 2000 17:25:05 +0200
From: "Eli Zaretskii" <eliz AT is DOT elta DOT co DOT il>
Sender: halo1 AT zahav DOT net DOT il
To: lauras AT softhome DOT net
Message-Id: <6480-Thu17Aug2000172504+0300-eliz@is.elta.co.il>
X-Mailer: Emacs 20.6 (via feedmail 8.2.emacs20_6 I) and Blat ver 1.8.5b
CC: djgpp-workers AT delorie DOT com
In-reply-to: <399BE30E.AA1F3E6C@softhome.net> (message from Laurynas Biveinis
on Thu, 17 Aug 2000 15:05:18 +0200)
Subject: Re: Patch: __internal_readlink()
References: <399BE30E DOT AA1F3E6C AT softhome DOT net>
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

> Date: Thu, 17 Aug 2000 15:05:18 +0200
> From: Laurynas Biveinis <lauras AT softhome DOT net>
>
> +int __internal_readlink(const char * __path, int __fhandle, char * __buf, 
> +                        size_t __max)
> +{
> +   ssize_t       bytes_read         = 0;
> +   char          buf[_SYMLINK_FILE_LEN];
> +   char        * data_buf;
> +   int           fd;
> +   struct ffblk  file_info;
> +   int           ret;
> +   off_t         old_pos = 0;
> +   long          file_size;
> +
> +   /* Provide ability to hook symlink support */
> +   if (__FSEXT_call_open_handlers(__FSEXT_readlink, &ret, &__path))
> +      return ret;

This is not so simple in this particular case, since
__internal_readlink can be called either with a file name or with a
handle.  In the latter case, __FSEXT_call_open_handlers will not do,
because it searches the wrong list of handlers.

I think you need to test for handle-or-path up front, and if you get a
handle, use code such as _close does:

  __FSEXT_Function *func = __FSEXT_get_function(handle);
  if (func)
  {
    ...

Of course, if you already tested the code you've posted, and it works,
then disregard my comments ;-).

- Raw text -


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