@@ -106,7 +106,7 @@ static void test_memcmp_magic(void) {
106
106
// Should be ok to set it more than once, even to different things, before opening.
107
107
r = db->set_memcmp_magic (db, 1 ); CKERR (r);
108
108
r = db->set_memcmp_magic (db, 2 ); CKERR (r);
109
- r = db->open (db, NULL , " db" , NULL , DB_BTREE, DB_CREATE, 0666 ); CKERR (r);
109
+ r = db->open (db, NULL , " db" , " db " , DB_BTREE, DB_CREATE, 0666 ); CKERR (r);
110
110
111
111
// Can't set the memcmp magic after opening.
112
112
r = db->set_memcmp_magic (db, 0 ); CKERR2 (r, EINVAL);
@@ -116,12 +116,17 @@ static void test_memcmp_magic(void) {
116
116
r = db_create (&db2, env, 0 ); CKERR (r);
117
117
r = db2->set_memcmp_magic (db2, 3 ); CKERR (r); // ..we can try setting it to something different
118
118
// ..but it should fail to open
119
- r = db2->open (db2, NULL , " db" , NULL , DB_BTREE, DB_CREATE, 0666 ); CKERR2 (r, EINVAL);
119
+ r = db2->open (db2, NULL , " db" , " db " , DB_BTREE, DB_CREATE, 0666 ); CKERR2 (r, EINVAL);
120
120
r = db2->set_memcmp_magic (db2, 2 ); CKERR (r);
121
- r = db2->open (db2, NULL , " db" , NULL , DB_BTREE, DB_CREATE, 0666 ); CKERR (r);
122
- r = db2->close (db2, 0 );
121
+ r = db2->open (db2, NULL , " db" , " db" , DB_BTREE, DB_CREATE, 0666 ); CKERR (r);
123
122
123
+ r = db2->close (db2, 0 );
124
124
r = db->close (db, 0 ); CKERR (r);
125
+
126
+ // dbremove opens its own handle internally. ensure that the open
127
+ // operation succeeds (and so does dbremove) despite the fact the
128
+ // internal open does not set the memcmp magic
129
+ r = env->dbremove (env, NULL , " db" , " db" , 0 ); CKERR (r);
125
130
r = env->close (env, 0 ); CKERR (r);
126
131
}
127
132
@@ -155,7 +160,7 @@ static void test_memcmp_magic_sort_order(void) {
155
160
DB *db;
156
161
r = db_create (&db, env, 0 ); CKERR (r);
157
162
r = db->set_memcmp_magic (db, magic); CKERR (r);
158
- r = db->open (db, NULL , " db" , NULL , DB_BTREE, DB_CREATE, 0666 ); CKERR (r);
163
+ r = db->open (db, NULL , " db" , " db " , DB_BTREE, DB_CREATE, 0666 ); CKERR (r);
159
164
160
165
for (int i = 0 ; i < 10000 ; i++) {
161
166
char buf[1 + sizeof (int )];
@@ -192,6 +197,11 @@ static void test_memcmp_magic_sort_order(void) {
192
197
txn->commit (txn, 0 );
193
198
194
199
r = db->close (db, 0 ); CKERR (r);
200
+
201
+ // dbremove opens its own handle internally. ensure that the open
202
+ // operation succeeds (and so does dbremove) despite the fact the
203
+ // internal open does not set the memcmp magic
204
+ r = env->dbremove (env, NULL , " db" , " db" , 0 ); CKERR (r);
195
205
r = env->close (env, 0 ); CKERR (r);
196
206
}
197
207
0 commit comments