summaryrefslogtreecommitdiff
path: root/examples/c/ex_pack.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/c/ex_pack.c')
-rw-r--r--examples/c/ex_pack.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/c/ex_pack.c b/examples/c/ex_pack.c
index 43b57880674..86725123f55 100644
--- a/examples/c/ex_pack.c
+++ b/examples/c/ex_pack.c
@@ -55,14 +55,18 @@ main(void)
home = NULL;
/* Open a connection to the database, creating it if necessary. */
- if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0)
+ if ((ret = wiredtiger_open(home, NULL, "create", &conn)) != 0) {
fprintf(stderr, "Error connecting to %s: %s\n",
- home, wiredtiger_strerror(ret));
+ home == NULL ? "." : home, wiredtiger_strerror(ret));
+ return (EXIT_FAILURE);
+ }
/* Open a session for the current thread's work. */
- if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0)
+ if ((ret = conn->open_session(conn, NULL, NULL, &session)) != 0) {
fprintf(stderr, "Error opening a session on %s: %s\n",
- home, wiredtiger_strerror(ret));
+ home == NULL ? "." : home, wiredtiger_strerror(ret));
+ return (EXIT_FAILURE);
+ }
{
/*! [packing] */
@@ -81,9 +85,11 @@ main(void)
}
/* Note: closing the connection implicitly closes open session(s). */
- if ((ret = conn->close(conn, NULL)) != 0)
+ if ((ret = conn->close(conn, NULL)) != 0) {
fprintf(stderr, "Error closing %s: %s\n",
- home, wiredtiger_strerror(ret));
+ home == NULL ? "." : home, wiredtiger_strerror(ret));
+ return (EXIT_FAILURE);
+ }
- return (ret);
+ return (EXIT_SUCCESS);
}