memcpy(&tdb->header, newdb, sizeof(tdb->header));
/* Convert the `ondisk' version if asked. */
TDB1_CONV(*newdb);
return 0;
}
memcpy(&tdb->header, newdb, sizeof(tdb->header));
/* Convert the `ondisk' version if asked. */
TDB1_CONV(*newdb);
return 0;
}
/* Don't endian-convert the magic food! */
memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
/* we still have "ret == -1" here */
/* Don't endian-convert the magic food! */
memcpy(newdb->magic_food, TDB_MAGIC_FOOD, strlen(TDB_MAGIC_FOOD)+1);
/* we still have "ret == -1" here */
tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR,
"tdb1_open_ex: could not open file %s: %s",
name, strerror(errno));
tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR,
"tdb1_open_ex: could not open file %s: %s",
name, strerror(errno));
- v = fcntl(tdb->fd, F_GETFD, 0);
- fcntl(tdb->fd, F_SETFD, v | FD_CLOEXEC);
+ v = fcntl(tdb->file->fd, F_GETFD, 0);
+ fcntl(tdb->file->fd, F_SETFD, v | FD_CLOEXEC);
/* ensure there is only one process initialising at once */
if (tdb1_nest_lock(tdb, TDB1_OPEN_LOCK, F_WRLCK, TDB_LOCK_WAIT) == -1) {
/* ensure there is only one process initialising at once */
if (tdb1_nest_lock(tdb, TDB1_OPEN_LOCK, F_WRLCK, TDB_LOCK_WAIT) == -1) {
|| strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0) {
if (!(open_flags & O_CREAT) || tdb1_new_database(tdb, hash_size) == -1) {
if (errno == 0) {
|| strcmp(tdb->header.magic_food, TDB_MAGIC_FOOD) != 0) {
if (!(open_flags & O_CREAT) || tdb1_new_database(tdb, hash_size) == -1) {
if (errno == 0) {
tdb->flags |= TDB_CONVERT;
tdb1_convert(&tdb->header, sizeof(tdb->header));
}
tdb->flags |= TDB_CONVERT;
tdb1_convert(&tdb->header, sizeof(tdb->header));
}
- tdb->map_size = st.st_size;
- tdb->device = st.st_dev;
- tdb->inode = st.st_ino;
+ tdb->file->map_size = st.st_size;
+ tdb->file->device = st.st_dev;
+ tdb->file->inode = st.st_ino;
tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR,
"tdb1_open_ex: failed to close tdb->fd on error!");
tdb_logerr(tdb, TDB_ERR_IO, TDB_LOG_ERROR,
"tdb1_open_ex: failed to close tdb->fd on error!");