Re: [Nagios-devel] another [patch] Solaris fix for cfg_dir Re: Bug:
Posted: Wed Jan 23, 2008 5:05 am
Jan Grant wrote:
> Attached is a patch against nagios-2.10 which carefully cuts out the
> uses of d_type in dirent, if that's missing, and just falls back to
> using stat (which follows symlinks).
>
> This makes recursive cfg_dir structures work on Solaris 10.
>
> Excuse the hackery: I've just carefully inserted additional checks for
> _DIRENT_HAVE_D_TYPE around block ends.
>
Umm... This patch makes the code excessively hard to read, since block
starts and ends are now inside #ifdef's.
I was thinking something along the lines of
while (de = readdir(dirp)) {
struct stat st;
if (stat(de->d_name)
> PS. I'm reasonably certain that what nagios tries to do in the cfg_dir
> handling is unnecessarily clever; since stat() follows symlinks anyway,
> just checking for file or directory types with a single stat() call
> should be sufficient.
>
Yes, that's exactly what I meant.
Care to resend?
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]
> Attached is a patch against nagios-2.10 which carefully cuts out the
> uses of d_type in dirent, if that's missing, and just falls back to
> using stat (which follows symlinks).
>
> This makes recursive cfg_dir structures work on Solaris 10.
>
> Excuse the hackery: I've just carefully inserted additional checks for
> _DIRENT_HAVE_D_TYPE around block ends.
>
Umm... This patch makes the code excessively hard to read, since block
starts and ends are now inside #ifdef's.
I was thinking something along the lines of
while (de = readdir(dirp)) {
struct stat st;
if (stat(de->d_name)
> PS. I'm reasonably certain that what nagios tries to do in the cfg_dir
> handling is unnecessarily clever; since stat() follows symlinks anyway,
> just checking for file or directory types with a single stat() call
> should be sufficient.
>
Yes, that's exactly what I meant.
Care to resend?
--
Andreas Ericsson [email protected]
OP5 AB www.op5.se
Tel: +46 8-230225 Fax: +46 8-230231
This post was automatically imported from historical nagios-devel mailing list archives
Original poster: [email protected]