delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/08/24/12:35:32

Message-ID: <39A5506B.AF66ADB8@softhome.net>
Date: Thu, 24 Aug 2000 18:42:19 +0200
From: Laurynas Biveinis <lauras AT softhome DOT net>
X-Mailer: Mozilla 4.74 [en] (Win98; U)
X-Accept-Language: lt,en
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Symlink resolving rewrite
References: <39A5266F DOT 2C931D88 AT softhome DOT net> <6137-Thu24Aug2000180231+0300-eliz AT is DOT elta DOT co DOT il>
Reply-To: djgpp-workers AT delorie DOT com

Eli Zaretskii wrote:
> Assuming this indeed is needed, wouldn't it be a better design to have
> a function that resolves one path component at a time?  Then you could
> simply call it in a loop, replacing the slash after each part with a
> '\0', and accumulate the full resolved path as you go.

It's the same thing __solve_symlinks() is doing now. It calls readlink() in 
a loop, however it assumes that readlink will resolve only the last path 
part. And there is nothing wrong with that except perfomance. 

I think I've got it: what about making readlink() follow symlinks as advertised,
and leave __internal_readlink() not to follow symlinks, as it does now? Then
simply replace readlink() calls in __solve_symlinks() to __internal_readlink() 
calls. If it is OK, then it is five times less work for me to do :)

Laurynas

- Raw text -


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