diff options
author | Keith Bostic <keith@wiredtiger.com> | 2013-11-14 10:59:15 -0500 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2013-11-14 10:59:15 -0500 |
commit | f324202c9cfb341dbb352674ca1c70dd9f00cb72 (patch) | |
tree | a4d7521474b7c7c6ffedbdac9c10d28a614498d5 /src/schema/schema_plan.c | |
parent | 8cd2c93905b9c27e0d73398f4f45d2781671a612 (diff) | |
download | mongo-f324202c9cfb341dbb352674ca1c70dd9f00cb72.tar.gz |
__wt_config_next() has lots of possible errors, check for not-found
at the end of the loop.
Diffstat (limited to 'src/schema/schema_plan.c')
-rw-r--r-- | src/schema/schema_plan.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/schema/schema_plan.c b/src/schema/schema_plan.c index 44b69c0cf9f..acde7a11183 100644 --- a/src/schema/schema_plan.c +++ b/src/schema/schema_plan.c @@ -14,6 +14,7 @@ __find_next_col(WT_SESSION_IMPL *session, WT_TABLE *table, WT_COLGROUP *colgroup; WT_CONFIG conf; WT_CONFIG_ITEM cval, k, v; + WT_DECL_RET; u_int cg, col, foundcg, foundcol, matchcg, matchcol; int getnext; @@ -40,7 +41,7 @@ cgcols: cval = colgroup->colconf; col = table->nkey_columns; } WT_RET(__wt_config_subinit(session, &conf, &cval)); - for (; __wt_config_next(&conf, &k, &v) == 0; col++) { + for (; (ret = __wt_config_next(&conf, &k, &v)) == 0; col++) { if (k.len == colname->len && strncmp(colname->str, k.str, k.len) == 0) { if (getnext) { @@ -53,6 +54,7 @@ cgcols: cval = colgroup->colconf; col == table->nkey_columns - 1) goto cgcols; } + WT_RET_TEST(ret != WT_NOTFOUND, ret); colgroup = NULL; } @@ -101,6 +103,7 @@ __wt_schema_colcheck(WT_SESSION_IMPL *session, WT_RET(__wt_config_subinit(session, &conf, colconf)); for (ncols = 0; (ret = __wt_config_next(&conf, &k, &v)) == 0; ncols++) ; + WT_RET_TEST(ret != WT_NOTFOUND, ret); if (ncols != 0 && ncols != kcols + vcols) WT_RET_MSG(session, EINVAL, "Number of columns in '%.*s' " @@ -153,8 +156,7 @@ __wt_table_check(WT_SESSION_IMPL *session, WT_TABLE *table) WT_ASSERT(session, coltype == WT_PROJ_VALUE); } - if (ret != WT_NOTFOUND) - return (ret); + WT_RET_TEST(ret != WT_NOTFOUND, ret); return (0); } @@ -171,6 +173,7 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, { WT_CONFIG conf; WT_CONFIG_ITEM k, v; + WT_DECL_RET; u_int cg, col, current_cg, current_col, i, start_cg, start_col; int have_it; char coltype, current_coltype; @@ -186,7 +189,7 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, current_cg = cg = 0; current_col = col = INT_MAX; current_coltype = coltype = WT_PROJ_KEY; /* Keep lint quiet. */ - for (i = 0; __wt_config_next(&conf, &k, &v) == 0; i++) { + for (i = 0; (ret = __wt_config_next(&conf, &k, &v)) == 0; i++) { have_it = 0; while (__find_next_col(session, table, @@ -241,6 +244,7 @@ __wt_struct_plan(WT_SESSION_IMPL *session, WT_TABLE *table, current_col = col + 1; } } + WT_RET_TEST(ret != WT_NOTFOUND, ret); /* Special case empty plans. */ if (i == 0 && plan->size == 0) |