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

SourceForge.net noreply at sourceforge.net
Mon Oct 9 12:21:57 CEST 2006


Bugs item #1573638, was opened at 2006-10-09 10:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1573638&group_id=29880

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: Open
Resolution: None
Priority: 5
Submitted By: Duncan Ferguson (duncan_ferguson)
Assigned to: Nobody/Anonymous (nobody)
Summary: check_swap SEGV's on Solaris 10

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
SUNW,Sun-Fire-V440

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

It seems to compile ok:
===
if gcc
-DLOCALEDIR=\"/home/loki/fergusod/cvsroot/nagios2/shared/egg-nagios2cl/package/usr/local/nagios2cl/share/locale\"
-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
-L/tmp/nagios-plugins-HEAD-200610082352/plugins
-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)

#  ifdef CHECK_SWAP_SWAPCTL_SVR4

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

  /* initialize swap table + entries */
 
tbl=(swaptbl_t*)malloc(sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
  memset(tbl, 0,
sizeof(swaptbl_t)+(sizeof(swapent_t)*nswaps));
  tbl->swt_n=nswaps;
  for(i=0;i<nswaps;i++){
    ent=&tbl->swt_ent[i];
    ent->ste_path=(char*)malloc(sizeof(char)*MAXPATHLEN);
  }

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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=397597&aid=1573638&group_id=29880




More information about the Devel mailing list