diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-12-24 11:15:21 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-12-24 11:15:21 -0500 |
commit | baa157b40673c027acf1ddcb99fedb848a660885 (patch) | |
tree | a69a301ed798ffd3bfd7b533cb8a8cfbdfcb2674 /examples | |
parent | bc7ed41d8e3d9c268c0d57600a36d32c98bdf8b0 (diff) | |
download | mongo-baa157b40673c027acf1ddcb99fedb848a660885.tar.gz |
Add wiredtiger_strerror_r, a thread-safe version of wiredtiger_strerror,
which allows us to support Windows' errors where we have to allocate a
buffer to get the error string.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/c/ex_all.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index 01966b5196f..bf5a588274b 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -342,6 +342,22 @@ cursor_ops(WT_SESSION *session) /*! [Display an error] */ } + { + /*! [Display an error thread safe] */ + const char *key = "non-existent key"; + cursor->set_key(cursor, key); + if ((ret = cursor->remove(cursor)) != 0) { + char buf[128]; + + if (wiredtiger_strerror_r(ret, buf, sizeof(buf)) != 0) + (void)snprintf( + buf, sizeof(buf), "error value: %d\n", ret); + fprintf(stderr, "cursor.remove: %s\n", buf); + return (ret); + } + /*! [Display an error thread safe] */ + } + /*! [Close the cursor] */ ret = cursor->close(cursor); /*! [Close the cursor] */ |