[patch] FreeBSD fix for cfg_dir Re: Bug: cfg_dir doesn't work on solaris..?
Jan Grant
jan.grant at bristol.ac.uk
Wed Jan 23 13:12:51 CET 2008
On Wed, 23 Jan 2008, Andreas Ericsson wrote:
> Jan Grant wrote:
> >
> > Attached is a patch against nagios-2.10 which detects the "missing"
> > _DIRENT_HAVE_D_TYPE on BSD systems (the heuristic is to look for
> > DT_UNKNOWN) and defines it in those cases.
> >
>
> The patch looks decent, but it's the wrong fix. When d_type is present,
> Nagios will still stat() the dirent to see if it's a directory before
> recursing into it. A more proper fix would be to ignore d_type and
> just rely on S_ISDIR(st.st_mode) to check for directories.
>
> That'll make it work the same on every system too, which is most
> definitely a Good Thing(tm).
>
> I'll get to work on this when I have time, although I fear it won't
> be until I've completed my current project at work and then have
> looked into the config parsing code and the event-queue problems.
>
> A Nagios hackathon would be a neat idea, and small stuff like this
> could get sorted in no-time. Hmm, perhaps I shall see if I can get
> the boss to sponsor one :-)
I've just supplied a second patch that works in the absence of
_DIRENT_HAVE_D_TYPE (ie, on Solaris amongst others). By chopping out
everything bracketted by those #ifdefs, the result should be what you're
after.
FWIW I could probably find some time to attend a (European) hackathon.
Cheers,
jan
--
jan grant, ISYS, University of Bristol. http://www.bris.ac.uk/
Tel +44 (0)117 3317661 http://ioctl.org/jan/
Unfortunately, I have a very good idea how fast my keys are moving.
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
More information about the Developers
mailing list