mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
ITS#5248: use volatile sig_atomic_t for signal variables gotintr, abcan
This commit is contained in:
parent
24d9258888
commit
adea0057f8
@ -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;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user