cluster/cman/cman_tool join.c
CVSROOT: /cvs/cluster
Module name: cluster
Branch: RHEL5
Changes by: pcaulfield at sourceware.org 2006-12-12 16:51:11
Modified files:
cman/cman_tool : join.c
Log message:
Fix minor bug where cman_tool join didn't spot that aisexec had started correctly or crashed.
This means we can up the timer for allowing aisexec to start with no ill effects. see bz#218688
cman/cman_tool/join.c +17 -9
@@ -11,6 +11,7 @@******************************************************************************* ******************************************************************************/ +#include <sys/wait.h> #include <stdint.h> #include <signal.h> #include <netinet/in.h>
@@ -148,6 +149,7 @@/* Give the daemon a chance to start up, and monitor the pipe FD for messages */ i =0 ; +close (p[1 ]); do { fd_set fds; struct timeval tv={1, 0};
@@ -158,13 +160,6 @@FD_SET (p[0 ], &fds); status =select (p[0 ]+1 , &fds,NULL ,NULL , &tv); -if (status ==0 ) { - h =cman_admin_init (NULL ); -if (!h && comline->verbose) - { -fprintf (stderr,"waiting for aisexec to start\n" ); - } - }/* Did we get an error? */ if (status ==1 ) {
@@ -172,9 +167,22 @@fprintf (stderr,"cman not started: %s\n" , message);break ; } - +else { +int pidstatus; +if (waitpid (aisexec_pid, &pidstatus,WNOHANG ) ==0 ) +fprintf (stderr,"cman died with status: %d\n" ,WEXITSTATUS (pidstatus)); +else + status =0 ;/* Try to connect */ + } + } +if (status ==0 ) { + h =cman_admin_init (NULL ); +if (!h && comline->verbose) + { +fprintf (stderr,"waiting for aisexec to start\n" ); + } } - }while (!h && ++i <20 ); + }while (!h && ++i <100 );if (!h)die ("aisexec daemon didn't start" );