[fpc-pascal] RE: findfirst and findnext on non accessible files

Marc Santhoff M.Santhoff at t-online.de
Wed Jun 28 23:41:13 CEST 2006

Am Mittwoch, den 28.06.2006, 12:17 -0500 schrieb Jeff Pohlmeyer:
> If I remember correctly, the DOS FindFirst/Next only handles
> shortstring-sized path names.

If possible at all I will not use DOS unit.

> Another "quirk" about using FindNext on Unix is that a
> symlink to a directory sets the faDirectory flag, and if it
> happens to be a circular symlink,  I don't know of any
> way tell if it is safe to recurse into it without using fpStat
> or something like it. FindNext will eventually give up after
> several loops, but that doesn't seem like a very
> elegant way to handle the situation.

This should be no problem in principle, since the unix syscalls detect
this state and fail (according to Stevens[1]). But relying on the system
working properly is no good policy ...

What I don't understand is why the var "errno" is not set or it's value
is destroyed before Findfirst/-Next return. Does this value has to be
set explicitely by using fpseterrno()? It returns always -1 in case of
permission denied.


[1] W.Richard Stevens: "Advanced Programming in the Unix Environment"
aka "THE Stevens"

More information about the fpc-pascal mailing list