Changeset 746 for vendor/current/lib/tdb


Ignore:
Timestamp:
Nov 27, 2012, 4:56:06 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated vendor to 3.6.9

Location:
vendor/current/lib/tdb/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/lib/tdb/common/io.c

    r740 r746  
    5454        }
    5555
     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
    5664        if (st.st_size < (size_t)len) {
    5765                if (!probe) {
     
    6472        }
    6573
    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);
    7374        return 0;
    7475}
  • vendor/current/lib/tdb/common/open.c

    r740 r746  
    314314            (!tdb->read_only) &&
    315315            (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) {
    318320                        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;
    322346                }
    323347        }
Note: See TracChangeset for help on using the changeset viewer.