Changeset 746 for vendor/current/lib/tdb
- Timestamp:
- Nov 27, 2012, 4:56:06 PM (13 years ago)
- Location:
- vendor/current/lib/tdb/common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/lib/tdb/common/io.c
r740 r746 54 54 } 55 55 56 /* Unmap, update size, remap */ 57 if (tdb_munmap(tdb) == -1) { 58 tdb->ecode = TDB_ERR_IO; 59 return -1; 60 } 61 tdb->map_size = st.st_size; 62 tdb_mmap(tdb); 63 56 64 if (st.st_size < (size_t)len) { 57 65 if (!probe) { … … 64 72 } 65 73 66 /* Unmap, update size, remap */67 if (tdb_munmap(tdb) == -1) {68 tdb->ecode = TDB_ERR_IO;69 return -1;70 }71 tdb->map_size = st.st_size;72 tdb_mmap(tdb);73 74 return 0; 74 75 } -
vendor/current/lib/tdb/common/open.c
r740 r746 314 314 (!tdb->read_only) && 315 315 (locked = (tdb_nest_lock(tdb, ACTIVE_LOCK, F_WRLCK, TDB_LOCK_NOWAIT|TDB_LOCK_PROBE) == 0))) { 316 open_flags |= O_CREAT; 317 if (ftruncate(tdb->fd, 0) == -1) { 316 int ret; 317 ret = tdb_brlock(tdb, F_WRLCK, FREELIST_TOP, 0, 318 TDB_LOCK_WAIT); 319 if (ret == -1) { 318 320 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 319 "failed to truncate %s: %s\n", 320 name, strerror(errno))); 321 goto fail; /* errno set by ftruncate */ 321 "tdb_brlock failed for %s: %s\n", 322 name, strerror(errno))); 323 goto fail; 324 } 325 ret = tdb_new_database(tdb, hash_size); 326 if (ret == -1) { 327 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 328 "tdb_new_database failed for %s: %s\n", 329 name, strerror(errno))); 330 tdb_unlockall(tdb); 331 goto fail; 332 } 333 ret = tdb_brunlock(tdb, F_WRLCK, FREELIST_TOP, 0); 334 if (ret == -1) { 335 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 336 "tdb_unlockall failed for %s: %s\n", 337 name, strerror(errno))); 338 goto fail; 339 } 340 ret = lseek(tdb->fd, 0, SEEK_SET); 341 if (ret == -1) { 342 TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_open_ex: " 343 "lseek failed for %s: %s\n", 344 name, strerror(errno))); 345 goto fail; 322 346 } 323 347 }
Note:
See TracChangeset
for help on using the changeset viewer.