]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-shell/abandon.c
Don't reeval expression
[openldap] / servers / slapd / back-shell / abandon.c
index 8bfb3c9a419e591ba119fb7bea846fd48dd5fa26..bbf84db331fb15c1bebb9b5e5a27aa53882b6f3a 100644 (file)
@@ -1,9 +1,13 @@
 /* abandon.c - shell backend abandon function */
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 
 #include "portable.h"
 
 #include <stdio.h>
-#include <signal.h>
 
 #include <ac/socket.h>
 #include <ac/string.h>
@@ -28,30 +32,17 @@ shell_back_abandon(
        if ( si->si_abandon == NULL ) {
                ldap_pvt_thread_mutex_lock( &conn->c_mutex );
                pid = -1;
-               for ( o = conn->c_ops; o != NULL; o = o->o_next ) {
+               LDAP_STAILQ_FOREACH( o, &conn->c_ops, o_next ) {
                        if ( o->o_msgid == msgid ) {
                                pid = (pid_t) o->o_private;
                                break;
                        }
                }
-               if( pid == -1 ) {
-                       for ( o = conn->c_pending_ops; o != NULL; o = o->o_next ) {
-                               if ( o->o_msgid == msgid ) {
-                                       pid = (pid_t) o->o_private;
-                                       break;
-                               }
-                       }
-               }
                ldap_pvt_thread_mutex_unlock( &conn->c_mutex );
+       }
 
-               if ( pid != -1 ) {
-                       Debug( LDAP_DEBUG_ARGS, "shell killing pid %d\n", pid,
-                           0, 0 );
-                       kill( pid, SIGTERM );
-               } else {
-                       Debug( LDAP_DEBUG_ARGS, "shell could not find op %d\n",
-                           msgid, 0, 0 );
-               }
+       if ( pid == -1 ) {
+               Debug( LDAP_DEBUG_ARGS, "shell could not find op %d\n", msgid, 0, 0 );
                return 0;
        }
 
@@ -63,6 +54,7 @@ shell_back_abandon(
        fprintf( wfp, "ABANDON\n" );
        fprintf( wfp, "msgid: %d\n", msgid );
        print_suffixes( wfp, be );
+       fprintf( wfp, "pid: %ld\n", (long) pid );
        fclose( wfp );
 
        /* no result from abandon */