[Nagiosplug-devel] check_tcp on solaris

hans hm04 hm04.yer at ma.yer.at
Sun Sep 19 02:56:02 CEST 2004


hi all 

the following problem exists on solaris with check_tcp:
we receive signal 11, if the tcp-connection to a given
port could not be established. so the signal must be catched, 
otherwise we die ungracefully with exit status 139 and 
core-dump. 

i don't know, who is the maintainer, but could you be so kind
and apply with patch the following modifications 
to files "configure" an "check_tcp.c" 

best regards 
hans 

-- 

cut off the line with = 
======================================================================
*** configure_orig      Mon Dec  1 03:55:45 2003
--- configure   Fri Sep 17 00:43:04 2004
***************
*** 23189,23194 ****
--- 23189,23198 ----
  
  DEFS=-DHAVE_CONFIG_H
  
+ case `uname` in 
+   SunOS ) DEFS="$DEFS -DSOLARIS" ;; 
+ esac 
+ 
  ac_libobjs=
  ac_ltlibobjs=
  for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
======================================================================
*** check_tcp.c_orig    Wed Nov 12 04:49:02 2003
--- check_tcp.c Sun Sep 19 11:26:10 2004
***************
*** 92,100 ****
--- 92,115 ----
  char *buffer;
  
  
+ #ifdef SOLARIS 
+ /* hack by hans mayer - nagiosplugin at ma.yer.at */
+ /* handles socket unavailability  on solaris */
+ void
+ socket_unavail_alarm_handler (int sig)
+ {
+         if (sig == SIGSEGV)
+         {
+                 printf ("TCP CRITICAL - Connection refused\n" );
+               exit (STATE_CRITICAL);
+         } ; 
+ }
+ #endif 
  
  
  
+ 
+ 
  

  int
  main (int argc, char **argv)
***************
*** 219,224 ****
--- 234,248 ----
        /* initialize alarm signal handling */
        signal (SIGALRM, socket_timeout_alarm_handler);
  
+ #ifdef SOLARIS 
+ /* hack by hans mayer 
+  * we receive signal 11 if connection couldn't be established
+  * on  solaris - so catch it 
+  */
+       signal (SIGSEGV, socket_unavail_alarm_handler);
+ #endif 
+ 
+ 
        /* set socket timeout */
        alarm (socket_timeout);
======================================================================




More information about the Devel mailing list