z

Commercial Support Clients: Clients with support contracts can get escalated support assistance by visiting Nagios Answer Hub. These forums are for community support services. Although we at Nagios try our best to help out on the forums here, we always give priority support to our support clients.

Re: [Nagios-devel] Erroneous use of getcwd on lib/nspath.c

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.

Re: [Nagios-devel] Erroneous use of getcwd on lib/nspath.c

Postby Guest » Fri Oct 26, 2012 3:07 pm

On 10/26/2012 03:12 PM, Ricardo Jose Maraschini wrote:
>
> Accordingly to manpages and some home made tests, getcwd returns NULL
> when an error occurs, not a value < 0.
>

Ah, right. Good catch.

> Following, on openbsd MAX_PATH is 1024 bytes while in linux it is 4096
> bytes, so i thought it would be ok to include and use macro
> MAX_PATH, not a fixed size of 4096.
>

I think you mean PATH_MAX. 4096 is the upper limit, so we'll be fine
using that (except for truly pathological cases where someone may
use a system where PATH_MAX is larger).

> Also we don't need to make sizeof(path) - 1 when calling getcwd.
> Quoting manpage:
>
> "The size argument is the size, in bytes, of the array referenced by
> buf."
>

We need an extra byte to spare for a nul byte in case the system we're
on doesn't leave any room for it in its getcwd() implementation (AIX,
for instance).

> Is it sounds resonable?

Sort of, but it's not important and the current code works just fine
as it is, so I'll drop this patch for now, apart from the return
code check thing.

Thanks.

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

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.





This post was automatically imported from historical nagios-devel mailing list archives
Original poster: ae@op5.se
Guest
 

Return to Open Source Nagios Projects

Who is online

Users browsing this forum: Google [Bot] and 23 guests