source: branches/samba-3.0/source/tdb/common/open.c

Last change on this file was 165, checked in by Paul Smedley, 16 years ago

Add 'missing' 3.0.34 diffs

File size: 17.6 KB
Line 
1 /*
2 Unix SMB/CIFS implementation.
3
4 trivial database library
5
6 Copyright (C) Andrew Tridgell 1999-2005
7 Copyright (C) Paul `Rusty' Russell 2000
8 Copyright (C) Jeremy Allison 2000-2003
9
10 ** NOTE! The following LGPL license applies to the tdb
11 ** library. This does NOT imply that all of Samba is released
12 ** under the LGPL
13
14 This library is free software; you can redistribute it and/or
15 modify it under the terms of the GNU Lesser General Public
16 License as published by the Free Software Foundation; either
17 version 2 of the License, or (at your option) any later version.
18
19 This library is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 Lesser General Public License for more details.
23
24 You should have received a copy of the GNU Lesser General Public
25 License along with this library; if not, write to the Free Software
26 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27*/
28
29#include "tdb_private.h"
30
31/* all contexts, to ensure no double-opens (fcntl locks don't nest!) */
32static struct tdb_context *tdbs = NULL;
33
34
35/* This is based on the hash algorithm from gdbm */
36static unsigned int default_tdb_hash(TDB_DATA *key)
37{
38 u32 value; /* Used to compute the hash value. */
39 u32 i; /* Used to cycle through random values. */
40
41 /* Set the initial value from the key size. */
42 for (value = 0x238F13AF * key->dsize, i=0; i < key->dsize; i++)
43 value = (value + (key->dptr[i] << (i*5 % 24)));
44
45 return (1103515243 * value + 12345);
46}
47
48
49/* initialise a new database with a specified hash size */
50static int tdb_new_database(struct tdb_context *tdb, int hash_size)
51{
52 struct tdb_header *newdb;
53 size_t size;
54 int ret = -1;
55 ssize_t written;
56
57 /* We make it up in memory, then write it out if not internal */
58 size = sizeof(struct tdb_header) + (hash_size+1)*sizeof(tdb_off_t);
59 if (!(newdb = (struct tdb_header *)calloc(size, 1)))
60 return TDB_ERRCODE(TDB_ERR_OOM, -1);
61
62 /* Fill in the header */
63 newdb->version = TDB_VERSION;
64 newdb->hash_size = hash_size;
65 if (tdb->flags & TDB_INTERNAL) {
66 tdb->map_size = size;
67 tdb->map_ptr = (char *)newdb;
68 memcpy(&tdb->header, newdb, sizeof(tdb->header));
69 /* Convert the `ondisk' version if asked. */
70 CONVERT(*newdb);
71 return 0;
72 }
73 if (lseek(tdb->fd, 0, SEEK_SET) == -1)
74 goto fail;
75
76 if (ftruncate(tdb->fd, 0) == -1)
77 goto fail;
78
79 /* This creates an endian-converted header, as if read from disk */
80 CONVERT(*newdb);
81 memcpy(&tdb->header, newdb, sizeof(tdb->header));
82 /* Don't endian-convert the magic food! */
83 memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
84 /* we still have "ret == -1" here */
85 written = write(tdb->fd, newdb, size);
86 if (written == size) {
87 ret = 0;
88 } else if (written != -1) {
89 /* call write once again, this usually should return -1 and
90 * set errno appropriately */
91 size -= written;
92 written = write(tdb->fd, newdb+written, size);
93 if (written == size) {
94 ret = 0;
95 } else if (written >= 0) {
96 /* a second incomplete write - we give up.
97 * guessing the errno... */
98 errno = ENOSPC;
99 }
100 }
101
102 fail:
103 SAFE_FREE(newdb);
104 return ret;
105}
106
107
108
109static int tdb_already_open(dev_t device,
110 ino_t ino)
111{
112 struct tdb_context *i;
113
114 for (i = tdbs; i; i = i->next) {
115 if (i->device == device && i->inode == ino) {
116 return 1;
117 }
118 }
119
120 return 0;
121}
122
123/* open the database, creating it if necessary
124
125 The open_flags and mode are passed straight to the open call on the
126 database file. A flags value of O_WRONLY is invalid. The hash size
127 is advisory, use zero for a default value.
128
129 Return is NULL on error, in which case errno is also set. Don't
130 try to call tdb_error or tdb_errname, just do strerror(errno).
131
132 @param name may be NULL for internal databases. */
133struct tdb_context *tdb_open(const char *name, int hash_size, int tdb_flags,
134 int open_flags, mode_t mode)
135{
136 return tdb_open_ex(name, hash_size, tdb_flags, open_flags, mode, NULL, NULL);
137}
138
139/* a default logging function */
140static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
141static void null_log_fn(struct tdb_context *tdb, enum tdb_debug_level level, const char *fmt, ...)
142{
143}
144
145
146struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags,
147 int open_flags, mode_t mode,
148 const struct tdb_logging_context *log_ctx,
149 tdb_hash_func hash_fn)
150{
151 struct tdb_context *tdb;
152 struct stat st;
153 int rev = 0, locked = 0;
154 unsigned char *vp;
155 u32 vertest;
156
157 if (!(tdb = (struct tdb_context *)calloc(1, sizeof *tdb))) {
158 /* Can't log this */
159 errno = ENOMEM;
160 goto fail;
161 }
162 tdb_io_init(tdb);
163 tdb->fd = -1;
164 tdb->name = NULL;
165 tdb->map_ptr = NULL;
166 tdb->flags = tdb_flags;
167 tdb->open_flags = open_flags;
168 if (log_ctx) {
169 tdb->log = *log_ctx;
170 } else {
171 tdb->log.log_fn = null_log_fn;
172 tdb->log.log_private = NULL;
173 }
174 tdb->hash_fn = hash_fn ? hash_fn : default_tdb_hash;
175
176#ifdef __OS2__
177 if (!(tdb->flags & TDB_INTERNAL))
178 {
179 char szSem[_MAX_PATH];
180 char drive[_MAX_DRIVE], dir[_MAX_DIR];
181 char fname[_MAX_FNAME], ext[_MAX_EXT];
182 APIRET rc;
183 // extract path info
184 _splitpath( name, drive, dir, fname, ext);
185 sprintf( szSem, "\\SEM32\\TDB_GL_%s%s%s", dir, fname, ext);
186 rc = DosCreateMutexSem( szSem, &tdb->hGlobalLock, 0, FALSE);
187 if (rc == ERROR_DUPLICATE_NAME)
188 rc = DosOpenMutexSem( szSem, &tdb->hGlobalLock);
189 if (rc != NO_ERROR) {
190 printf( "cannot open %s %d\n", szSem, rc);
191 errno = EINVAL;
192 goto fail;
193 }
194 TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_open_ex pid %d global handle %d\n", getpid(), tdb->hGlobalLock));
195 sprintf( szSem, "\\SEM32\\TDB_AL_%s%s%s", dir, fname, ext);
196 rc = DosCreateMutexSem( szSem, &tdb->hActiveLock, 0, FALSE);
197 if (rc == ERROR_DUPLICATE_NAME)
198 rc = DosOpenMutexSem( szSem, &tdb->hActiveLock);
199 if (rc != NO_ERROR) {
200 printf( "cannot open %s %d\n", szSem, rc);
201 errno = EINVAL;
202 goto fail;
203 }
204 TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_open_ex pid %d active handle %d\n", getpid(), tdb->hActiveLock));
205 sprintf( szSem, "\\SEM32\\TDB_TL_%s%s%s", dir, fname, ext);
206 rc = DosCreateMutexSem( szSem, &tdb->hTransactionLock, 0, FALSE);
207 if (rc == ERROR_DUPLICATE_NAME)
208 rc = DosOpenMutexSem( szSem, &tdb->hTransactionLock);
209 if (rc != NO_ERROR) {
210 printf( "cannot open %s %d\n", szSem, rc);
211 errno = EINVAL;
212 goto fail;
213 }
214 TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_open_ex pid %d transaction handle %d\n", getpid(), tdb->hTransactionLock));
215 }
216#endif
217
218 /* cache the page size */
219 tdb->page_size = getpagesize();
220 if (tdb->page_size <= 0) {
221 tdb->page_size = 0x2000;
222 }
223
224 if ((open_flags & O_ACCMODE) == O_WRONLY) {
225 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n",
226 name));
227 errno = EINVAL;
228 goto fail;
229 }
230
231 if (hash_size == 0)
232 hash_size = DEFAULT_HASH_SIZE;
233 if ((open_flags & O_ACCMODE) == O_RDONLY) {
234 tdb->read_only = 1;
235 /* read only databases don't do locking or clear if first */
236 tdb->flags |= TDB_NOLOCK;
237 tdb->flags &= ~TDB_CLEAR_IF_FIRST;
238 }
239
240 /* internal databases don't mmap or lock, and start off cleared */
241 if (tdb->flags & TDB_INTERNAL) {
242 tdb->flags |= (TDB_NOLOCK | TDB_NOMMAP);
243 tdb->flags &= ~TDB_CLEAR_IF_FIRST;
244 if (tdb_new_database(tdb, hash_size) != 0) {
245 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: tdb_new_database failed!"));
246 goto fail;
247 }
248 goto internal;
249 }
250
251 if ((tdb->fd = open(name, open_flags, mode)) == -1) {
252 TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_open_ex: could not open file %s: %s\n",
253 name, strerror(errno)));
254 goto fail; /* errno set by open(2) */
255 }
256
257 /* ensure there is only one process initialising at once */
258 if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_WRLCK, F_SETLKW, 0, 1) == -1) {
259 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to get global lock on %s: %s\n",
260 name, strerror(errno)));
261 goto fail; /* errno set by tdb_brlock */
262 }
263
264 /* we need to zero database if we are the only one with it open */
265 if ((tdb_flags & TDB_CLEAR_IF_FIRST)
266#ifndef __OS2__ // we already have global lock
267 && (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))
268#endif
269 ) {
270 open_flags |= O_CREAT;
271 if (ftruncate(tdb->fd, 0) == -1) {
272 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: "
273 "failed to truncate %s: %s\n",
274 name, strerror(errno)));
275 goto fail; /* errno set by ftruncate */
276 }
277 }
278
279 errno = 0;
280 if (read(tdb->fd, &tdb->header, sizeof(tdb->header)) != sizeof(tdb->header)
281 || strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0
282 || (tdb->header.version != TDB_VERSION
283 && !(rev = (tdb->header.version==TDB_BYTEREV(TDB_VERSION))))) {
284 /* its not a valid database - possibly initialise it */
285 if (!(open_flags & O_CREAT) || tdb_new_database(tdb, hash_size) == -1) {
286 if (errno == 0) {
287 errno = EIO; /* ie bad format or something */
288 }
289 goto fail;
290 }
291 rev = (tdb->flags & TDB_CONVERT);
292 }
293 vp = (unsigned char *)&tdb->header.version;
294 vertest = (((u32)vp[0]) << 24) | (((u32)vp[1]) << 16) |
295 (((u32)vp[2]) << 8) | (u32)vp[3];
296 tdb->flags |= (vertest==TDB_VERSION) ? TDB_BIGENDIAN : 0;
297 if (!rev)
298 tdb->flags &= ~TDB_CONVERT;
299 else {
300 tdb->flags |= TDB_CONVERT;
301 tdb_convert(&tdb->header, sizeof(tdb->header));
302 }
303 if (fstat(tdb->fd, &st) == -1)
304 goto fail;
305
306 if (tdb->header.rwlocks != 0) {
307 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: spinlocks no longer supported\n"));
308 goto fail;
309 }
310
311 /* Is it already in the open list? If so, fail. */
312 if (tdb_already_open(st.st_dev, st.st_ino)) {
313 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: "
314 "%s (%d,%d) is already open in this process\n",
315 name, (int)st.st_dev, (int)st.st_ino));
316 errno = EBUSY;
317 goto fail;
318 }
319
320 if (!(tdb->name = (char *)strdup(name))) {
321 errno = ENOMEM;
322 goto fail;
323 }
324
325 tdb->map_size = st.st_size;
326 tdb->device = st.st_dev;
327 tdb->inode = st.st_ino;
328 tdb->max_dead_records = 0;
329 tdb_mmap(tdb);
330 if (locked) {
331#ifndef __OS2__
332 if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) {
333 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: "
334 "failed to take ACTIVE_LOCK on %s: %s\n",
335 name, strerror(errno)));
336 goto fail;
337 }
338#endif
339 }
340
341 /* We always need to do this if the CLEAR_IF_FIRST flag is set, even if
342 we didn't get the initial exclusive lock as we need to let all other
343 users know we're using it. */
344
345#ifndef __OS2__
346 if (tdb_flags & TDB_CLEAR_IF_FIRST) {
347 /* leave this lock in place to indicate it's in use */
348 if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1)
349 goto fail;
350 }
351#endif
352
353 /* if needed, run recovery */
354 if (tdb_transaction_recover(tdb) == -1) {
355 goto fail;
356 }
357
358 // YD internal databases do not get global lock!
359 if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1) == -1)
360 goto fail;
361
362 internal:
363 /* Internal (memory-only) databases skip all the code above to
364 * do with disk files, and resume here by releasing their
365 * global lock and hooking into the active list. */
366#ifndef __OS2__
367 if (tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLKW, 0, 1) == -1)
368 goto fail;
369#endif
370 tdb->next = tdbs;
371 tdbs = tdb;
372 return tdb;
373
374 fail:
375 { int save_errno = errno;
376
377 if (!tdb)
378 return NULL;
379
380 if (tdb->map_ptr) {
381 if (tdb->flags & TDB_INTERNAL)
382 SAFE_FREE(tdb->map_ptr);
383 else
384 tdb_munmap(tdb);
385 }
386 SAFE_FREE(tdb->name);
387#ifdef __OS2__
388 DosCloseMutexSem( tdb->hGlobalLock);
389 tdb->hGlobalLock = 0;
390 DosCloseMutexSem( tdb->hActiveLock);
391 tdb->hActiveLock = 0;
392 DosCloseMutexSem( tdb->hTransactionLock);
393 tdb->hTransactionLock = 0;
394#endif
395 if (tdb->fd != -1)
396 if (close(tdb->fd) != 0)
397 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: failed to close tdb->fd on error!\n"));
398 SAFE_FREE(tdb);
399 errno = save_errno;
400 return NULL;
401 }
402}
403
404/*
405 * Set the maximum number of dead records per hash chain
406 */
407
408void tdb_set_max_dead(struct tdb_context *tdb, int max_dead)
409{
410 tdb->max_dead_records = max_dead;
411}
412
413/**
414 * Close a database.
415 *
416 * @returns -1 for error; 0 for success.
417 **/
418int tdb_close(struct tdb_context *tdb)
419{
420 struct tdb_context **i;
421 int ret = 0;
422
423 if (tdb->transaction) {
424 tdb_transaction_cancel(tdb);
425 }
426
427 if (tdb->map_ptr) {
428 if (tdb->flags & TDB_INTERNAL)
429 SAFE_FREE(tdb->map_ptr);
430 else
431 tdb_munmap(tdb);
432 }
433 SAFE_FREE(tdb->name);
434 // YD internal databases do not have a global lock
435 if (!(tdb->flags & TDB_INTERNAL))
436 tdb->methods->tdb_brlock(tdb, GLOBAL_LOCK, F_UNLCK, F_SETLK, 0, 1);
437 if (tdb->fd != -1)
438 ret = close(tdb->fd);
439 SAFE_FREE(tdb->lockrecs);
440#ifdef __OS2__
441 DosCloseMutexSem( tdb->hGlobalLock);
442 tdb->hGlobalLock = 0;
443 DosCloseMutexSem( tdb->hActiveLock);
444 tdb->hActiveLock = 0;
445 DosCloseMutexSem( tdb->hTransactionLock);
446 tdb->hTransactionLock = 0;
447#endif
448
449 /* Remove from contexts list */
450 for (i = &tdbs; *i; i = &(*i)->next) {
451 if (*i == tdb) {
452 *i = tdb->next;
453 break;
454 }
455 }
456
457 memset(tdb, 0, sizeof(*tdb));
458 SAFE_FREE(tdb);
459
460 return ret;
461}
462
463/* register a loging function */
464void tdb_set_logging_function(struct tdb_context *tdb,
465 const struct tdb_logging_context *log_ctx)
466{
467 tdb->log = *log_ctx;
468}
469
470void *tdb_get_logging_private(struct tdb_context *tdb)
471{
472 return tdb->log.log_private;
473}
474
475/* reopen a tdb - this can be used after a fork to ensure that we have an independent
476 seek pointer from our parent and to re-establish locks */
477int tdb_reopen(struct tdb_context *tdb)
478{
479 struct stat st;
480
481 TDB_LOG((tdb, TDB_DEBUG_TRACE, "tdb_reopen pid %d\n", getpid()));
482
483 if (tdb->flags & TDB_INTERNAL) {
484 return 0; /* Nothing to do. */
485 }
486
487#ifdef __OS2__
488
489 DosCloseMutexSem( tdb->hGlobalLock);
490 tdb->hGlobalLock = 0;
491 DosCloseMutexSem( tdb->hActiveLock);
492 tdb->hActiveLock = 0;
493 DosCloseMutexSem( tdb->hTransactionLock);
494 tdb->hTransactionLock = 0;
495
496 if (!(tdb->flags & TDB_INTERNAL))
497 {
498 char szSem[_MAX_PATH];
499 char drive[_MAX_DRIVE], dir[_MAX_DIR];
500 char fname[_MAX_FNAME], ext[_MAX_EXT];
501 APIRET rc;
502 // extract path info
503 _splitpath( tdb->name, drive, dir, fname, ext);
504 sprintf( szSem, "\\SEM32\\TDB_GL_%s%s%s", dir, fname, ext);
505 rc = DosCreateMutexSem( szSem, &tdb->hGlobalLock, 0, FALSE);
506 if (rc == ERROR_DUPLICATE_NAME)
507 rc = DosOpenMutexSem( szSem, &tdb->hGlobalLock);
508 if (rc != NO_ERROR) {
509 printf( "cannot open %s %d\n", szSem, rc);
510 errno = EINVAL;
511 goto fail;
512 }
513 TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_reopen pid %d global handle %d\n", getpid(), tdb->hGlobalLock));
514 sprintf( szSem, "\\SEM32\\TDB_AL_%s%s%s", dir, fname, ext);
515 rc = DosCreateMutexSem( szSem, &tdb->hActiveLock, 0, FALSE);
516 if (rc == ERROR_DUPLICATE_NAME)
517 rc = DosOpenMutexSem( szSem, &tdb->hActiveLock);
518 if (rc != NO_ERROR) {
519 printf( "cannot open %s %d\n", szSem, rc);
520 errno = EINVAL;
521 goto fail;
522 }
523 TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_reopen pid %d active handle %d\n", getpid(), tdb->hActiveLock));
524 sprintf( szSem, "\\SEM32\\TDB_TL_%s%s%s", dir, fname, ext);
525 rc = DosCreateMutexSem( szSem, &tdb->hTransactionLock, 0, FALSE);
526 if (rc == ERROR_DUPLICATE_NAME)
527 rc = DosOpenMutexSem( szSem, &tdb->hTransactionLock);
528 if (rc != NO_ERROR) {
529 printf( "cannot open %s %d\n", szSem, rc);
530 errno = EINVAL;
531 goto fail;
532 }
533 TDB_LOG((tdb, TDB_DEBUG_TRACE,"tdb_reopen pid %d transaction handle %d\n", getpid(), tdb->hTransactionLock));
534 }
535#endif
536
537 if (tdb->num_locks != 0 || tdb->global_lock.count) {
538 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_reopen: reopen not allowed with locks held\n"));
539 goto fail;
540 }
541
542 if (tdb->transaction != 0) {
543 TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_reopen: reopen not allowed inside a transaction\n"));
544 goto fail;
545 }
546
547 if (tdb_munmap(tdb) != 0) {
548 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: munmap failed (%s)\n", strerror(errno)));
549 goto fail;
550 }
551 if (close(tdb->fd) != 0)
552 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: WARNING closing tdb->fd failed!\n"));
553 tdb->fd = open(tdb->name, tdb->open_flags & ~(O_CREAT|O_TRUNC), 0);
554 if (tdb->fd == -1) {
555 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: open failed (%s)\n", strerror(errno)));
556 goto fail;
557 }
558 if ((tdb->flags & TDB_CLEAR_IF_FIRST) &&
559 (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_RDLCK, F_SETLKW, 0, 1) == -1)) {
560 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: failed to obtain active lock\n"));
561 goto fail;
562 }
563 if (fstat(tdb->fd, &st) != 0) {
564 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: fstat failed (%s)\n", strerror(errno)));
565 goto fail;
566 }
567 if (st.st_ino != tdb->inode || st.st_dev != tdb->device) {
568 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_reopen: file dev/inode has changed!\n"));
569 goto fail;
570 }
571 tdb_mmap(tdb);
572
573 return 0;
574
575fail:
576 tdb_close(tdb);
577 return -1;
578}
579
580/* reopen all tdb's */
581int tdb_reopen_all(int parent_longlived)
582{
583 struct tdb_context *tdb;
584
585 for (tdb=tdbs; tdb; tdb = tdb->next) {
586 /*
587 * If the parent is longlived (ie. a
588 * parent daemon architecture), we know
589 * it will keep it's active lock on a
590 * tdb opened with CLEAR_IF_FIRST. Thus
591 * for child processes we don't have to
592 * add an active lock. This is essential
593 * to improve performance on systems that
594 * keep POSIX locks as a non-scalable data
595 * structure in the kernel.
596 */
597 if (parent_longlived) {
598 /* Ensure no clear-if-first. */
599 tdb->flags &= ~TDB_CLEAR_IF_FIRST;
600 }
601
602 if (tdb_reopen(tdb) != 0)
603 return -1;
604 }
605
606 return 0;
607}
Note: See TracBrowser for help on using the repository browser.