We have RCS files within (subdirectories of) the Nagios configuration
directories. Since these files don't have a ".cfg" suffix, they should
be ignored by Nagios. However, Nagios _sometimes_ treats these files as
if they were directories and bails out because it can't opendir() them.
This happens because
1) only the file name but not the full path is passed to the stat() call
which is done for checking the type of a non-cfg file, and then
2) the return value of this stat() call is interpreted the wrong way
round: "!=0" is treated as "success" and therefore "stat_buf" will be
read. This is also done for an earlier stat() call (which is not
related to this bug though).
The attached patch fixes these problems.
PGP fingerprint: F1F0 9071 8084 A426 DD59 9839 59D3 F3A1 B8B5 D3DE