From: Kurt Zeilenga Date: Fri, 31 Aug 2001 01:53:16 +0000 (+0000) Subject: Import ITS#1071 -c fix X-Git-Tag: OPENLDAP_REL_ENG_2_0_13~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e67f0c5d041e65ce6f4e8e651e1ef4c4bed9616e;p=thirdparty%2Fopenldap.git Import ITS#1071 -c fix --- diff --git a/clients/tools/ldapdelete.c b/clients/tools/ldapdelete.c index 7aee669ce2..57a1444b70 100644 --- a/clients/tools/ldapdelete.c +++ b/clients/tools/ldapdelete.c @@ -626,18 +626,23 @@ main( int argc, char **argv ) } rc = 0; + if ( fp == NULL ) { - for ( ; optind < argc; ++optind ) { - rc = dodelete( ld, argv[ optind ] ); - } - } else { - while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) { - buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */ - if ( *buf != '\0' ) { - rc = dodelete( ld, buf ); - } + for ( ; optind < argc; ++optind ) { + rc = dodelete( ld, argv[ optind ] ); + + /* Stop on error and no -c option */ + if( rc != 0 && contoper == 0) break; + } + } else { + while ((rc == 0 || contoper) && fgets(buf, sizeof(buf), fp) != NULL) { + buf[ strlen( buf ) - 1 ] = '\0'; /* remove trailing newline */ + + if ( *buf != '\0' ) { + rc = dodelete( ld, buf ); + } + } } - } ldap_unbind( ld );