[patch] FreeBSD fix for cfg_dir Re: Bug: cfg_dir doesn't work on solaris..?

Andreas Ericsson ae at op5.se
Wed Jan 23 09:41:40 CET 2008


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 :-)

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

-------------------------------------------------------------------------
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