[Pkg-openldap-devel] r1346 - in openldap/trunk/debian: . patches
matthijs at alioth.debian.org
matthijs at alioth.debian.org
Sat Mar 26 19:14:20 UTC 2011
tags 616164 pending
thanks
Author: matthijs
Date: 2011-03-26 19:14:14 +0000 (Sat, 26 Mar 2011)
New Revision: 1346
Modified:
openldap/trunk/debian/changelog
openldap/trunk/debian/patches/service-operational-before-detach
Log:
* Update patch service-operational-before-detach with the patch from ubuntu,
which in turn comes from OpenLDAP.
Modified: openldap/trunk/debian/changelog
===================================================================
--- openldap/trunk/debian/changelog 2011-03-26 18:48:16 UTC (rev 1345)
+++ openldap/trunk/debian/changelog 2011-03-26 19:14:14 UTC (rev 1346)
@@ -8,8 +8,9 @@
by default to /etc/ssl/certs/ca-certificates.crt (Closes: #555409, #616703)
* Add patch to fix a FTBFS with binutils-gold (Closes: #555867)
* Add slapschema, just hardlink it (Closes: #601569)
+ * Update patch service-operational-before-detach (Closes: #616164)
- -- Matthijs Möhlmann <matthijs at cacholong.nl> Sat, 26 Mar 2011 18:36:26 +0100
+ -- Matthijs Möhlmann <matthijs at cacholong.nl> Sat, 26 Mar 2011 20:12:46 +0100
openldap (2.4.23-7) unstable; urgency=low
Modified: openldap/trunk/debian/patches/service-operational-before-detach
===================================================================
--- openldap/trunk/debian/patches/service-operational-before-detach 2011-03-26 18:48:16 UTC (rev 1345)
+++ openldap/trunk/debian/patches/service-operational-before-detach 2011-03-26 19:14:14 UTC (rev 1346)
@@ -1,56 +1,113 @@
+--- a/include/lutil.h
++++ b/include/lutil.h
+@@ -48,7 +48,7 @@
+ size_t));
+
+ /* detach.c */
+-LDAP_LUTIL_F( void )
++LDAP_LUTIL_F( int )
+ lutil_detach LDAP_P((
+ int debug,
+ int do_close));
+--- a/libraries/liblutil/detach.c
++++ b/libraries/liblutil/detach.c
+@@ -49,10 +49,10 @@
+
+ #include "lutil.h"
+
+-void
++int
+ lutil_detach( int debug, int do_close )
+ {
+- int i, sd, nbits;
++ int i, sd, nbits, pid;
+
+ #ifdef HAVE_SYSCONF
+ nbits = sysconf( _SC_OPEN_MAX );
+@@ -71,10 +71,11 @@
+ if ( debug == 0 ) {
+ for ( i = 0; i < 5; i++ ) {
+ #ifdef HAVE_THR
+- switch ( fork1() )
++ pid = fork1();
+ #else
+- switch ( fork() )
++ pid = fork();
+ #endif
++ switch( pid )
+ {
+ case -1:
+ sleep( 5 );
+@@ -85,6 +86,7 @@
+
+ default:
+ _exit( EXIT_SUCCESS );
++ return pid;
+ }
+ break;
+ }
+@@ -139,4 +141,5 @@
+ #ifdef SIGPIPE
+ (void) SIGNAL( SIGPIPE, SIG_IGN );
+ #endif
++ return 0;
+ }
--- a/servers/slapd/main.c
+++ b/servers/slapd/main.c
-@@ -902,14 +902,28 @@
- (void) SIGNAL( SIGBREAK, slap_sig_shutdown );
+@@ -368,6 +368,9 @@
+ int syslogUser = SLAP_DEFAULT_SYSLOG_USER;
#endif
+
++#ifndef HAVE_WINSOCK
++ int pid, waitfds[2];
++#endif
+ int g_argc = argc;
+ char **g_argv = argv;
--#ifndef HAVE_WINSOCK
-- lutil_detach( no_detach, 0 );
--#endif /* HAVE_WINSOCK */
--
- #ifdef CSRIMALLOC
- mal_leaktrace(1);
+@@ -848,7 +851,7 @@
+ if( rc != 0) {
+ Debug( LDAP_DEBUG_ANY,
+ "main: TLS init failed: %d\n",
+- 0, 0, 0 );
++ rc, 0, 0 );
+ rc = 1;
+ SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 20 );
+ goto destroy;
+@@ -903,7 +906,24 @@
#endif
-+ /*
-+ * FIXME: moved here from slapd_daemon_task()
-+ * because back-monitor db_open() needs it
-+ */
-+ time( &starttime );
-+
-+ connections_init();
-+
-+ if ( slap_startup( NULL ) != 0 ) {
+ #ifndef HAVE_WINSOCK
+- lutil_detach( no_detach, 0 );
++ if ( lutil_pair( waitfds ) < 0 ) {
++ Debug( LDAP_DEBUG_ANY,
++ "main: lutil_pair failed: %d\n",
++ 0, 0, 0 );
+ rc = 1;
-+ SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 21 );
-+ goto shutdown;
++ goto destroy;
+ }
-+
-+#ifndef HAVE_WINSOCK
-+ lutil_detach( no_detach, 0 );
-+#endif /* HAVE_WINSOCK */
-+
- if ( slapd_pid_file != NULL ) {
- FILE *fp = fopen( slapd_pid_file, "w" );
++ pid = lutil_detach( no_detach, 0 );
++ if ( pid ) {
++ char buf[4];
++ rc = EXIT_SUCCESS;
++ close( waitfds[1] );
++ if ( read( waitfds[0], buf, 1 ) != 1 )
++ rc = EXIT_FAILURE;
++ _exit( rc );
++ } else {
++ close( waitfds[0] );
++ }
+ #endif /* HAVE_WINSOCK */
-@@ -958,20 +972,6 @@
- slapd_args_file_unlink = 1;
- }
+ #ifdef CSRIMALLOC
+@@ -974,6 +994,11 @@
-- /*
-- * FIXME: moved here from slapd_daemon_task()
-- * because back-monitor db_open() needs it
-- */
-- time( &starttime );
--
-- connections_init();
--
-- if ( slap_startup( NULL ) != 0 ) {
-- rc = 1;
-- SERVICE_EXIT( ERROR_SERVICE_SPECIFIC_ERROR, 21 );
-- goto shutdown;
-- }
--
Debug( LDAP_DEBUG_ANY, "slapd starting\n", 0, 0, 0 );
++#ifndef HAVE_WINSOCK
++ write( waitfds[1], "1", 1 );
++ close( waitfds[1] );
++#endif
++
#ifdef HAVE_NT_EVENT_LOG
+ if (is_NT_Service)
+ lutil_LogStartedEvent( serverName, slap_debug, configfile ?
More information about the Pkg-openldap-devel
mailing list