Ignore:
Timestamp:
Nov 29, 2012, 2:06:31 PM (13 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: updated trunk to 3.6.9 2nd part

Location:
trunk/server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/server

  • trunk/server/lib/tdb/common/open.c

    r745 r752  
    328328            (!tdb->read_only) ) {
    329329#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) {
    332334                        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;
    336360                }
    337361        }
     
    412436                        goto fail;
    413437                }
     438
    414439#endif
    415440        }
     
    543568        }
    544569        SAFE_FREE(tdb->lockrecs);
     570
    545571#ifdef __OS2__
    546572        DosCloseMutexSem( tdb->hGlobalLock);
     
    551577        tdb->hTransactionLock = 0;
    552578#endif
    553 
    554579        /* Remove from contexts list */
    555580        for (i = &tdbs; *i; i = &(*i)->next) {
Note: See TracChangeset for help on using the changeset viewer.