Changeset 752 for trunk/server/lib/tdb/common/open.c
- Timestamp:
- Nov 29, 2012, 2:06:31 PM (13 years ago)
- Location:
- trunk/server
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server
- Property svn:mergeinfo changed
/vendor/current merged: 746,748
- Property svn:mergeinfo changed
-
trunk/server/lib/tdb/common/open.c
r745 r752 328 328 (!tdb->read_only) ) { 329 329 #endif 330 open_flags |= O_CREAT; 331 if (ftruncate(tdb->fd, 0) == -1) { 330 int ret; 331 ret = tdb_brlock(tdb, F_WRLCK, FREELIST_TOP, 0, 332 TDB_LOCK_WAIT); 333 if (ret == -1) { 332 334 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 333 "failed to truncate %s: %s\n", 334 name, strerror(errno))); 335 goto fail; /* errno set by ftruncate */ 335 "tdb_brlock failed for %s: %s\n", 336 name, strerror(errno))); 337 goto fail; 338 } 339 ret = tdb_new_database(tdb, hash_size); 340 if (ret == -1) { 341 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 342 "tdb_new_database failed for %s: %s\n", 343 name, strerror(errno))); 344 tdb_unlockall(tdb); 345 goto fail; 346 } 347 ret = tdb_brunlock(tdb, F_WRLCK, FREELIST_TOP, 0); 348 if (ret == -1) { 349 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 350 "tdb_unlockall failed for %s: %s\n", 351 name, strerror(errno))); 352 goto fail; 353 } 354 ret = lseek(tdb->fd, 0, SEEK_SET); 355 if (ret == -1) { 356 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 357 "lseek failed for %s: %s\n", 358 name, strerror(errno))); 359 goto fail; 336 360 } 337 361 } … … 412 436 goto fail; 413 437 } 438 414 439 #endif 415 440 } … … 543 568 } 544 569 SAFE_FREE(tdb->lockrecs); 570 545 571 #ifdef __OS2__ 546 572 DosCloseMutexSem( tdb->hGlobalLock); … … 551 577 tdb->hTransactionLock = 0; 552 578 #endif 553 554 579 /* Remove from contexts list */ 555 580 for (i = &tdbs; *i; i = &(*i)->next) {
Note:
See TracChangeset
for help on using the changeset viewer.