[Nagiosplug-devel] [ nagiosplug-Bugs-1573638 ] check_swap SEGV's on Solaris

SourceForge.net noreply at sourceforge.net
Thu Dec 7 17:11:44 CET 2006

Bugs item #1573638, was opened at 2006-10-09 11:21
Message generated for change (Comment added) made by tonvoon
You can respond by visiting: 

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: Duncan Ferguson (duncan_ferguson)
>Assigned to: Ton Voon (tonvoon)
Summary: check_swap SEGV's on Solaris

Initial Comment:
$ ./check_swap -w 20% -c 10%
swapctl failed: : Bad address
Segmentation Fault(coredump)
$ uname -a
SunOS xxxx 5.10 Generic_118833-18 sun4u sparc

This is from "nagios-plugins-HEAD-200610082352.tar.gz"

It seems to compile ok:
if gcc
-DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../lib -I../intl  
-I/usr/sfw//include   -I/usr/sfw//include  -g -O2 -MT
check_swap.o -MD -MP -MF ".deps/check_swap.Tpo" -c -o
check_swap.o check_swap.c; \
then mv -f ".deps/check_swap.Tpo"
".deps/check_swap.Po"; else rm -f
".deps/check_swap.Tpo"; exit 1; fi
In file included from check_swap.c:33:
common.h:216: warning: static declaration of 'floorf'
follows non-static declaration
/bin/bash ../libtool --tag=CC --mode=link gcc  -g -O2 
 -L/usr/sfw/lib -L. -L/usr/sfw//lib -o check_swap 
check_swap.o -lm utils.o ../lib/libnagiosplug.a
../lib/libcoreutils.a popen.o -lsocket  -lssl -lcrypto
gcc -g -O2 -o check_swap check_swap.o utils.o popen.o 
-L/usr/sfw//lib -lm ../lib/libnagiosplug.a
../lib/libcoreutils.a -lsocket -lssl -lcrypto

This appears to be the code at issue ( the SVR4 flag is
in effect rather than the BSD one)


  /* get the number of active swap devices */
  nswaps=swapctl(SC_GETNSWP, NULL);

  /* initialize swap table + entries */
  memset(tbl, 0,

  /* and now, tally 'em up */
  swapctl_res=swapctl(SC_LIST, tbl);
  if(swapctl_res < 0){
    perror(_("swapctl failed: "));
    result = STATE_WARNING;


>Comment By: Ton Voon (tonvoon)
Date: 2006-12-07 16:11

Logged In: YES 
Originator: NO


Closing this call as this is fixed via patch 1588031.



Comment By: Duncan Ferguson (duncan_ferguson)
Date: 2006-10-31 17:05

Logged In: YES 

I have submitted a patch in the tracker for check_swap to
fix the coredump on all solaris versions (and other SVR4
hosts) and tidy up the error output a little.  However, it
still does not work correctly as I keep getting the error
"swapctl failed: Bad address".

As far as I can tell (with a lot of hacking of the code by
commenting out everything possible) if compiled directly
using gcc it works, but when using "make" it doesnt, as
though something included via common.h, popen.h or utils.h
is causing an issue but i have so far been unable to trace
the cause.  I have also compared the code to an example at
but there are no disernable differences, leading me to think
the issue is outside of this source file.

I'll keep hacking incase by luck i find the issue.



You can respond by visiting: 

More information about the Devel mailing list