nagios_binary_path X_OK perm validation an misc changes
Andreas Ericsson
ae at op5.se
Wed Nov 28 12:54:00 CET 2012
On 11/14/2012 01:11 PM, Ricardo Jose Maraschini wrote:
> hya,
>
> aren't we supposed to check for exec permission on nagios binary file
> only after drop our privileges to nagios user?
> if that's right, the patch below make it happen after
> drop_privileges(). once we spawn our workers only when we're already
> running as nagios user, maybe the assumption above is right.
>
That's correct, but the patch is wrong. drop_privileges() will change
directories if we're running as a daemon, meaning relative paths to
the nagios binary can no longer be resolved.
Please fix that and resubmit this fix as a separate patch with a proper
commit message (in imperative form, please), and I'll apply it.
> another interesting think is that we keep calling
> getpid() function even if we already have pid on a variable, the patch
> below fixes it.
>
That's immaterial. getpid() is implemented, basically, as
return syscall(GETPID_SYSCALL_NR);
and thanks to sibling call optimizations that's about as fast as
accessing our own variable (mov + cmp vs call + cmp). Using a separate
variable for it gains us extremely little, and setting nagios_pid
before we know we're done daemonizing and then changing it afterwards
will just confuse people running it through a debugger.
Declined. Sorry.
> a last think, iobroker_create() may return NULL. in that case what
> is the correct behaviour? exit nagios?
>
Yes. Please resubmit this as a separate patch with a proper commit
message and signoff and I'll apply it.
> ah, ok, i miss that, we are exiting with ERROR code only in one place,
> all the others go out with EXIT_FAILURE, so i've change it.
>
Code churn, as "non-zero" means we failed, and ERROR is non-zero, but
resubmit as a separate patch with commit message and signoff and I'll
take that one too so we can avoid spurious warnings on HP-UX and such
systems that have compilers with strict type-value checking rules and
do hard casts to int for all negative numbers.
--
Andreas Ericsson andreas.ericsson at 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.
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
More information about the Developers
mailing list