Module Name: othersrc Committed By: agc Date: Thu Dec 3 01:43:33 UTC 2015
Modified Files: othersrc/external/bsd/sqlite3db/dist: main.c sqlite3db.c Log Message: check the return values from the "put" method To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/sqlite3db/dist/main.c cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/sqlite3db/dist/sqlite3db.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: othersrc/external/bsd/sqlite3db/dist/main.c diff -u othersrc/external/bsd/sqlite3db/dist/main.c:1.1.1.1 othersrc/external/bsd/sqlite3db/dist/main.c:1.2 --- othersrc/external/bsd/sqlite3db/dist/main.c:1.1.1.1 Thu Nov 26 19:22:46 2015 +++ othersrc/external/bsd/sqlite3db/dist/main.c Thu Dec 3 01:43:33 2015 @@ -66,6 +66,7 @@ create(const char *f, DBTYPE type) char *eq; DBT key; DBT value; + int ok; DB *db; if (f == NULL) { @@ -77,7 +78,7 @@ create(const char *f, DBTYPE type) warn("dump: can't open database '%s'", f); return 0; } - while (fgets(buf, sizeof(buf), stdin) != NULL) { + for (ok = 1 ; fgets(buf, sizeof(buf), stdin) != NULL ; ) { buf[strlen(buf) - 1] = 0x0; eq = strchr(buf, '='); key.data = buf; @@ -85,10 +86,12 @@ create(const char *f, DBTYPE type) buf[key.size] = 0x0; value.data = eq + 1; value.size = (size_t)strlen(eq + 1); - (*db->put)(db, &key, &value, 0); + if ((*db->put)(db, &key, &value, 0) != 0) { + ok = 0; + } } (*db->close)(db); - return 1; + return ok; } /* convert a bdb database to an sqlite3 one */ Index: othersrc/external/bsd/sqlite3db/dist/sqlite3db.c diff -u othersrc/external/bsd/sqlite3db/dist/sqlite3db.c:1.3 othersrc/external/bsd/sqlite3db/dist/sqlite3db.c:1.4 --- othersrc/external/bsd/sqlite3db/dist/sqlite3db.c:1.3 Fri Nov 27 06:05:26 2015 +++ othersrc/external/bsd/sqlite3db/dist/sqlite3db.c Thu Dec 3 01:43:33 2015 @@ -342,6 +342,7 @@ sqlite3db_convert(const char *oldf, cons { DBT value; DBT key; + int ok; DB *olddb; DB *newdb; @@ -353,11 +354,13 @@ sqlite3db_convert(const char *oldf, cons if (newdb == NULL) { return 0; } - while ((*olddb->seq)(olddb, &key, &value, R_NEXT) == 0) { - (*newdb->put)(newdb, &key, &value, 0); + for (ok = 1 ; (*olddb->seq)(olddb, &key, &value, R_NEXT) == 0 ; ) { + if ((*newdb->put)(newdb, &key, &value, 0) != 0) { + ok = 0; + } } (*olddb->close)(olddb); (*newdb->close)(newdb); - return 1; + return ok; }