[fpc-pascal] getlastoserror giving wrong value?
Marc Santhoff
M.Santhoff at t-online.de
Fri Dec 21 06:37:01 CET 2007
Hi,
when I try to use getlastoserror something "funny" happens.
We're dealing with:
$ ll /home/marc/program/Test_C/unreadable/
ls: : Permission denied
The source:
tmp := aFile^ + '/' + dirrec.Name;
writeln('file: '+ tmp );
n := fpaccess(tmp , R_OK);
writeln(n);
n := getlastoserror;
writeln(n);
The output:
file: /home/marc/program/Test_C/unreadable/
-1
-65523
If I do this:
program stat;
uses baseunix,errors,sysutils;
var
st: baseunix.stat;
res: integer;
begin
//res := fpstat('/home/marc/program/Test_C/unreadable/', st);
res := fpaccess('/home/marc/program/Test_C/unreadable/', R_OK);
writeln(res);
res := getlastoserror;
writeln(res);
end.
The result is correct:
$ ./stat
-1
13
and shows ESysEACCES as error number.
How can that happen?
Marc
More information about the fpc-pascal
mailing list