stat with no READ_CONTROL

Pierre A. Humblet Pierre.Humblet@ieee.org
Thu Jan 9 04:20:00 GMT 2003


Corinna,

when stat is called on a file with a non-readable security descriptor
(e.g. because of no READ_CONTROL permission), read_sd fails but stat
still succeeds. 
However the uid and gid are set to garbage (uninitialized automatic
variables) and the modes are from nontsec, rw-r--r--.
Other info, such as the times and size, can be correct.

The question is what to do about it. According to posix 
<http://www.opengroup.org/onlinepubs/007908799/xsh/fstat.html>
stat can (additional or alternative file access control mechanisms)
and must (cannot provide correct info) fail.

A consequence of this hard nosed approach is that ls -l may not show 
all files. To avoid that, stat could return uid = gid = -1 and modes = 0.

Which is best in this case: conformance to posix or user friendliness?

Pierre



More information about the Cygwin-developers mailing list