]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/add.c
Update of back-bdb2 to KDZ's new entry lock schema.
[openldap] / servers / slapd / back-shell / add.c
index c798e8c6c1404e4d81e3ee016df85121b4c98d2a..61752d3278b9174b697901c0a912aac5ec523c59 100644 (file)
 #include "slap.h"
 #include "shell.h"
 
-extern pthread_mutex_t entry2str_mutex;
-extern char            *entry2str();
-
-void
+int
 shell_back_add(
     Backend    *be,
     Connection *conn,
@@ -28,26 +25,27 @@ shell_back_add(
        if ( si->si_add == NULL ) {
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM, NULL,
                    "add not implemented" );
-               return;
+               return( -1 );
        }
 
-       if ( (op->o_private = forkandexec( si->si_add, &rfp, &wfp )) == -1 ) {
+       if ( (op->o_private = (void *) forkandexec( si->si_add, &rfp, &wfp )) == (void *) -1 ) {
                send_ldap_result( conn, op, LDAP_OPERATIONS_ERROR, NULL,
                    "could not fork/exec" );
-               return;
+               return( -1 );
        }
 
        /* write out the request to the add process */
        fprintf( wfp, "ADD\n" );
-       fprintf( wfp, "msgid: %d\n", op->o_msgid );
+       fprintf( wfp, "msgid: %ld\n", op->o_msgid );
        print_suffixes( wfp, be );
-       pthread_mutex_lock( &entry2str_mutex );
+       ldap_pvt_thread_mutex_lock( &entry2str_mutex );
        fprintf( wfp, "%s", entry2str( e, &len, 0 ) );
-       pthread_mutex_unlock( &entry2str_mutex );
+       ldap_pvt_thread_mutex_unlock( &entry2str_mutex );
        fclose( wfp );
 
        /* read in the result and send it along */
        read_and_send_results( be, conn, op, rfp, NULL, 0 );
 
        fclose( rfp );
+       return( 0 );
 }