diff options
author | Keith Bostic <keith@wiredtiger.com> | 2013-03-17 09:30:04 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2013-03-17 09:30:04 -0400 |
commit | 5ad09856003c860321cbaa3c587d62841fc39c9f (patch) | |
tree | 7dbdc395ee317ede709c8276867b8a6f606db984 | |
parent | 0e5225b8f85e9b9e7db5ef8f78e9166ef3c1b307 (diff) | |
download | mongo-5ad09856003c860321cbaa3c587d62841fc39c9f.tar.gz |
Don't drop core if an open fails, it's just a distraction from debugging.
-rw-r--r-- | examples/c/ex_all.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/examples/c/ex_all.c b/examples/c/ex_all.c index 94dd9b7323a..682fdf07468 100644 --- a/examples/c/ex_all.c +++ b/examples/c/ex_all.c @@ -994,12 +994,11 @@ main(void) WT_CONNECTION *conn; int ret; - { /*! [Open a connection] */ ret = wiredtiger_open(home, NULL, "create,cache_size=500M", &conn); /*! [Open a connection] */ - } - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); #ifdef MIGHT_NOT_RUN /* @@ -1007,23 +1006,21 @@ main(void) * be installed, causing the open to fail. The documentation requires * the code snippets, use #ifdef's to avoid running it. */ - { /*! [Configure bzip2 extension] */ ret = wiredtiger_open(home, NULL, "create," "extensions=[\"/usr/local/lib/wiredtiger_bzip2.so\"]", &conn); /*! [Configure bzip2 extension] */ - } - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); - { /*! [Configure snappy extension] */ ret = wiredtiger_open(home, NULL, "create," "extensions=[\"/usr/local/lib/wiredtiger_snappy.so\"]", &conn); /*! [Configure snappy extension] */ - } - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); /* * This example code gets run, and direct I/O might not be available, @@ -1034,31 +1031,36 @@ main(void) /*! [Configure direct_io for data files] */ ret = wiredtiger_open(home, NULL, "create,direct_io=[data]", &conn); /*! [Configure direct_io for data files] */ - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); #endif /*! [os_cache_dirty_max configuration] */ ret = wiredtiger_open(home, NULL, "create,os_cache_dirty_max=1GB", &conn); /*! [os_cache_dirty_max configuration] */ - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); /*! [os_cache_max configuration] */ ret = wiredtiger_open(home, NULL, "create,os_cache_max=1GB", &conn); /*! [os_cache_max configuration] */ - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); /*! [Statistics configuration] */ ret = wiredtiger_open(home, NULL, "create,statistics=true", &conn); /*! [Statistics configuration] */ - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); /*! [Statistics logging] */ ret = wiredtiger_open( home, NULL, "create,statistics_log=(wait=30)", &conn); /*! [Statistics logging] */ - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); #ifdef MIGHT_NOT_RUN /* @@ -1071,7 +1073,8 @@ main(void) "create," "statistics_log=(wait=120,path=\"/log/log.%m.%d.%y\")", &conn); /*! [Statistics logging with path] */ - (void)conn->close(conn, NULL); + if (ret == 0) + (void)conn->close(conn, NULL); #endif /*! [Get the WiredTiger library version #1] */ |