[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
ldapdelete -c option behaves inconsistently (ITS#1071)
Full_Name: Dave Steck
Version: devel
OS: NT
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (137.65.132.6)
In ldapdelete, when processing multiple filenames from an
external file, the -c option correctly causes it to continue
processing filenames even if an error occurs.
But when processing multiple filenames from the command line,
an error does not stop processing. This patch makes the -c
option behave consistently whether processing names from a
file or the command line. Also fixed indentation of this block.
Index: ldapdelete.c
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/clients/tools/ldapdelete.c,v
retrieving revision 1.75
diff -u -r1.75 ldapdelete.c
--- ldapdelete.c 2001/01/18 07:04:56 1.75
+++ ldapdelete.c 2001/03/14 18:14:22
@@ -627,16 +627,18 @@
rc = 0;
if ( fp == NULL ) {
- for ( ; optind < argc; ++optind ) {
- rc = dodelete( ld, argv[ optind ] );
- }
+ for ( ; optind < argc; ++optind ) {
+ rc = dodelete( ld, argv[ optind ] );
+ if ( rc != 0 && contoper == 0) /* Stop on error and no -c option */
+ 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 );
- }
- }
+ 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 );