]> git.sur5r.net Git - openldap/commitdiff
ITS#5248
authorQuanah Gibson-Mount <quanah@openldap.org>
Fri, 8 Feb 2008 20:06:06 +0000 (20:06 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Fri, 8 Feb 2008 20:06:06 +0000 (20:06 +0000)
CHANGES
clients/tools/common.c
servers/slapd/slapcat.c

diff --git a/CHANGES b/CHANGES
index 779cc3352ee2417b6cbf7e625ebd07c566f94e04..e1c5c57f992e17ddf90d2d2ec0e441ff62ba0ba7 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,7 @@ OpenLDAP 2.4 Change Log
 
 OpenLDAP 2.4.8 Engineering
        Fixed slapd include handling (ITS#5276)
+       Fixed slapd non-atomic signal variables (ITS#5248)
        Fixed libldap_r threaded library linking (ITS#4982)
        Documentation
                DB_CONFIG.example URL wrong in comments (ITS#5288)
index bffbf121d029ecd80b11e6ca4c0d12d69eb9537c..6fb304a6ec96ef3705ed88fb4afef40d11404a89 100644 (file)
@@ -149,8 +149,8 @@ static struct tool_ctrls_t {
 };
 
 /* "features" */
-static int     gotintr;
-static int     abcan;
+enum { Intr_None = 0, Intr_Abandon, Intr_Cancel, Intr_Ignore }; 
+static volatile sig_atomic_t   gotintr, abcan;
 
 
 #ifdef LDAP_CONTROL_X_SESSION_TRACKING
@@ -558,19 +558,19 @@ tool_args( int argc, char **argv )
 
                        /* this shouldn't go here, really; but it's a feature... */
                        } else if ( strcasecmp( control, "abandon" ) == 0 ) {
-                               abcan = LDAP_REQ_ABANDON;
+                               abcan = Intr_Abandon;
                                if ( crit ) {
                                        gotintr = abcan;
                                }
 
                        } else if ( strcasecmp( control, "cancel" ) == 0 ) {
-                               abcan = LDAP_REQ_EXTENDED;
+                               abcan = Intr_Cancel;
                                if ( crit ) {
                                        gotintr = abcan;
                                }
 
                        } else if ( strcasecmp( control, "ignore" ) == 0 ) {
-                               abcan = -1;
+                               abcan = Intr_Ignore;
                                if ( crit ) {
                                        gotintr = abcan;
                                }
@@ -746,7 +746,7 @@ tool_args( int argc, char **argv )
                case 'P':
                        ival = strtol( optarg, &next, 10 );
                        if ( next == NULL || next[0] != '\0' ) {
-                               fprintf( stderr, "%s: unabel to parse protocol version \"%s\"\n", prog, optarg );
+                               fprintf( stderr, "%s: unable to parse protocol version \"%s\"\n", prog, optarg );
                                exit( EXIT_FAILURE );
                        }
                        switch( ival ) {
@@ -1720,19 +1720,19 @@ tool_check_abandon( LDAP *ld, int msgid )
        int     rc;
 
        switch ( gotintr ) {
-       case LDAP_REQ_EXTENDED:
+       case Intr_Cancel:
                rc = ldap_cancel_s( ld, msgid, NULL, NULL );
                fprintf( stderr, "got interrupt, cancel got %d: %s\n",
                                rc, ldap_err2string( rc ) );
                return -1;
 
-       case LDAP_REQ_ABANDON:
+       case Intr_Abandon:
                rc = ldap_abandon_ext( ld, msgid, NULL, NULL );
                fprintf( stderr, "got interrupt, abandon got %d: %s\n",
                                rc, ldap_err2string( rc ) );
                return -1;
 
-       case -1:
+       case Intr_Ignore:
                /* just unbind, ignoring the request */
                return -1;
        }
index 73732963fc72d78d5595fbc98378a276ed99f313..1d09ee513ed433df69bf0c1f2efb13d7a99b9084 100644 (file)
@@ -32,7 +32,7 @@
 #include "slapcommon.h"
 #include "ldif.h"
 
-static int gotsig;
+static volatile sig_atomic_t gotsig;
 
 static RETSIGTYPE
 slapcat_sig( int sig )