mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-02-03 20:40:05 -05:00
Fix mdb_reader_list() and its spec.
It and the MDB_msg_func can now return >= 0 for success. Always return any MDB_msg_func() error result.
This commit is contained in:
parent
a58fd16ae5
commit
7e453c9763
2 changed files with 9 additions and 8 deletions
|
|
@ -1409,7 +1409,7 @@ int mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b);
|
|||
*
|
||||
* @param[in] msg The string to be printed.
|
||||
* @param[in] ctx An arbitrary context pointer for the callback.
|
||||
* @return < 0 on failure, 0 on success.
|
||||
* @return < 0 on failure, >= 0 on success.
|
||||
*/
|
||||
typedef int (MDB_msg_func)(const char *msg, void *ctx);
|
||||
|
||||
|
|
@ -1418,7 +1418,7 @@ typedef int (MDB_msg_func)(const char *msg, void *ctx);
|
|||
* @param[in] env An environment handle returned by #mdb_env_create()
|
||||
* @param[in] func A #MDB_msg_func function
|
||||
* @param[in] ctx Anything the message function needs
|
||||
* @return < 0 on failure, 0 on success.
|
||||
* @return < 0 on failure, >= 0 on success.
|
||||
*/
|
||||
int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx);
|
||||
|
||||
|
|
|
|||
|
|
@ -8299,7 +8299,7 @@ int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx)
|
|||
unsigned int i, rdrs;
|
||||
MDB_reader *mr;
|
||||
char buf[64];
|
||||
int first = 1;
|
||||
int rc = 0, first = 1;
|
||||
|
||||
if (!env || !func)
|
||||
return -1;
|
||||
|
|
@ -8311,7 +8311,6 @@ int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx)
|
|||
for (i=0; i<rdrs; i++) {
|
||||
if (mr[i].mr_pid) {
|
||||
size_t tid;
|
||||
int rc;
|
||||
tid = mr[i].mr_tid;
|
||||
if (mr[i].mr_txnid == (txnid_t)-1) {
|
||||
sprintf(buf, "%10d %"Z"x -\n", mr[i].mr_pid, tid);
|
||||
|
|
@ -8320,17 +8319,19 @@ int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx)
|
|||
}
|
||||
if (first) {
|
||||
first = 0;
|
||||
func(" pid thread txnid\n", ctx);
|
||||
rc = func(" pid thread txnid\n", ctx);
|
||||
if (rc < 0)
|
||||
break;
|
||||
}
|
||||
rc = func(buf, ctx);
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (first) {
|
||||
func("(no active readers)\n", ctx);
|
||||
rc = func("(no active readers)\n", ctx);
|
||||
}
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
/** Insert pid into list if not already present.
|
||||
|
|
|
|||
Loading…
Reference in a new issue