Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2003-08

Bug in S_ISDIR of fpc 1.0.10?

1 message · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Tobias Diekershoff

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

Reply by email