[fpc-pascal]Bug in S_ISDIR of fpc 1.0.10?

Tobias Diekershoff Tobias.D at t-online.de
Mon Aug 25 16:37:27 CEST 2003


Hello everyone!

Hope that's the right place for such things ;)

I've written a program using the LINUX unit, that looks through a
directory tree using the code-snipplet below. The purpose is to find the
subdirectories of the dir and then search in them, performing the same
routine.

The problem I encountered is, that some of the found directories are in
fact no dirs at all, and some other dirs aren't found. After some days
of searching for the buggy place I didn't find it, when I check those
files and dirs using "ls -l" the dirs are mod 755 and the files 644.

Is there a bug in S_ISDIR respectively in the FSTAT call or is something
wrong with my filesystem?

Thanks
  Tobias

[begin code snipplet from "getfiles" procedure]

    dirs := Glob('*');
    if LinuxError = 0 then
      while dirs <> nil do begin
        fstat (dirs^.name, info);
        if not (dirs^.name[0] = '.') then begin
          if S_ISDIR(info.mode) then begin
            if RunInDebug then writeln(' > checking ', dirs^.name);
            getfiles(dir + dirs^.name);
          end;
        end else
          if RunInDebug then writeln(' > skipping ', dirs^.name);
        dirs := dirs^.next;
      end;
    globfree(dirs);

[end code snipplet]
 
-- 
http://tobias.d.bei.t-online.de/  -=- PGP User ID: 0x825CE007
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20030825/13497fcf/attachment.sig>


More information about the fpc-pascal mailing list