*
* @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);
* @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);
unsigned int i, rdrs;
MDB_reader *mr;
char buf[64];
- int first = 1;
+ int rc = 0, first = 1;
if (!env || !func)
return -1;
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);
}
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.