From 4e22081e02abd6f280fa2c44fab97b884fb52222 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Mon, 3 Nov 2008 13:23:05 +0000 Subject: [PATCH] ITS#5745 report errors in shutdown processing --- servers/slapd/backend.c | 6 ++++-- servers/slapd/slapacl.c | 3 ++- servers/slapd/slapadd.c | 3 ++- servers/slapd/slapauth.c | 3 ++- servers/slapd/slapcat.c | 3 ++- servers/slapd/slapcommon.c | 10 +++++++--- servers/slapd/slapcommon.h | 2 +- servers/slapd/slapdn.c | 3 ++- servers/slapd/slapindex.c | 3 ++- servers/slapd/slaptest.c | 3 ++- 10 files changed, 26 insertions(+), 13 deletions(-) diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 459490b4ee..3754a258f2 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -349,11 +349,13 @@ int backend_shutdown( Backend *be ) } if ( be->bd_info->bi_db_close ) { - be->bd_info->bi_db_close( be, NULL ); + rc = be->bd_info->bi_db_close( be, NULL ); + if ( rc ) return rc; } if( be->bd_info->bi_close ) { - be->bd_info->bi_close( be->bd_info ); + rc = be->bd_info->bi_close( be->bd_info ); + if ( rc ) return rc; } return 0; diff --git a/servers/slapd/slapacl.c b/servers/slapd/slapacl.c index 67cf7b3b56..a6a56c29cd 100644 --- a/servers/slapd/slapacl.c +++ b/servers/slapd/slapacl.c @@ -399,7 +399,8 @@ destroy:; } } - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; } diff --git a/servers/slapd/slapadd.c b/servers/slapd/slapadd.c index 468dcea671..442446c1d2 100644 --- a/servers/slapd/slapadd.c +++ b/servers/slapd/slapadd.c @@ -447,7 +447,8 @@ slapadd( int argc, char **argv ) } } - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; } diff --git a/servers/slapd/slapauth.c b/servers/slapd/slapauth.c index 8934df3b29..0482f9ff5d 100644 --- a/servers/slapd/slapauth.c +++ b/servers/slapd/slapauth.c @@ -166,7 +166,8 @@ destroy:; if ( !BER_BVISNULL( &authzID ) ) { op->o_tmpfree( authzID.bv_val, op->o_tmpmemctx ); } - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; } diff --git a/servers/slapd/slapcat.c b/servers/slapd/slapcat.c index 6ea1952006..80586ef651 100644 --- a/servers/slapd/slapcat.c +++ b/servers/slapd/slapcat.c @@ -134,6 +134,7 @@ slapcat( int argc, char **argv ) be->be_entry_close( be ); - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; } diff --git a/servers/slapd/slapcommon.c b/servers/slapd/slapcommon.c index 6050629cd3..fad2bb9a96 100644 --- a/servers/slapd/slapcommon.c +++ b/servers/slapd/slapcommon.c @@ -740,13 +740,16 @@ startup:; } } -void slap_tool_destroy( void ) +int slap_tool_destroy( void ) { + int rc = 0; if ( !dryrun ) { if ( need_shutdown ) { - slap_shutdown( be ); + if ( slap_shutdown( be )) + rc = EXIT_FAILURE; } - slap_destroy(); + if ( slap_destroy()) + rc = EXIT_FAILURE; } #ifdef SLAPD_MODULES if ( slapMode == SLAP_SERVER_MODE ) { @@ -772,4 +775,5 @@ void slap_tool_destroy( void ) if ( ldiffp && ldiffp != &dummy ) { ldif_close( ldiffp ); } + return rc; } diff --git a/servers/slapd/slapcommon.h b/servers/slapd/slapcommon.h index 9cc22fed48..32138d1c22 100644 --- a/servers/slapd/slapcommon.h +++ b/servers/slapd/slapcommon.h @@ -101,6 +101,6 @@ void slap_tool_init LDAP_P(( int tool, int argc, char **argv )); -void slap_tool_destroy LDAP_P((void)); +int slap_tool_destroy LDAP_P((void)); #endif /* SLAPCOMMON_H_ */ diff --git a/servers/slapd/slapdn.c b/servers/slapd/slapdn.c index 2aa12232b2..ba32462dd4 100644 --- a/servers/slapd/slapdn.c +++ b/servers/slapd/slapdn.c @@ -99,7 +99,8 @@ slapdn( int argc, char **argv ) } } - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; } diff --git a/servers/slapd/slapindex.c b/servers/slapd/slapindex.c index 6b1f9bb92a..81ddf6ee93 100644 --- a/servers/slapd/slapindex.c +++ b/servers/slapd/slapindex.c @@ -99,6 +99,7 @@ slapindex( int argc, char **argv ) (void) be->be_entry_close( be ); - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return( rc ); } diff --git a/servers/slapd/slaptest.c b/servers/slapd/slaptest.c index c47abf85d7..e38bb0de69 100644 --- a/servers/slapd/slaptest.c +++ b/servers/slapd/slaptest.c @@ -108,7 +108,8 @@ slaptest( int argc, char **argv ) fprintf( stderr, "config file testing succeeded\n"); } - slap_tool_destroy(); + if ( slap_tool_destroy()) + rc = EXIT_FAILURE; return rc; } -- 2.39.5