Debug Mode Fix for NRPE

Stephen Kuenzli stephen_kuenzli at
Sat Feb 12 16:34:49 CET 2005

Good morning,
I am doing some work with NRPE and I ran across a
problem with DEBUG mode (the #define DEBUG, not the
debug configuration directive in nrpe.cfg).

If you #define DEBUG 1 and compile you will get a
compile error for an undeclared variable:
nrpe.c: In function `handle_connection':
nrpe.c:788: error: `fp' undeclared (first use in this
nrpe.c:788: error: (Each undeclared identifier is
reported only once
nrpe.c:788: error: for each function it appears in.)

I have fixed this error, and hopefully made the
program more useful by:
1. Declaring FILE pointers for both sending and
receiving NRPE packets
2. Writing the sent and received NRPE packets for both
nrpe and check_nrpe to the filesystem as:
* /tmp/packet-check_nrpe-send
* /tmp/packet-check_nrpe-receive
* /tmp/packet-nrpe-receive
* /tmp/packet-nrpe-send

These files are very useful for helping implement
applications that interoprate with nrpe and

Note that the #define DEBUG is not present in any
header files currently, and I did not add it.  I have
been testing with #define DEBUG 1 in common.h, though
this is not included in the patch.  Perhaps #define
DEBUG 0 should be set in common.h by default.

The attached patch is in unified diff format.  This is
my first time preparing a patch with diff (I usually
work within the happy confines of CVS'
tag/branch/merge structure), so if I have left
something out please let me know.  You should be able
to apply the patch with:
patch -p 1 -i nrpe_debug.patch

when you are in the root of an nrpe source


Do you Yahoo!? 
The all-new My Yahoo! - Get yours free! 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nrpe_debug.patch
Type: text/x-patch
Size: 2492 bytes
Desc: nrpe_debug.patch
URL: <>

More information about the Developers mailing list