Ignore:
Timestamp:
Jun 7, 2010, 9:08:40 AM (15 years ago)
Author:
Silvan Scherrer
Message:

Samba Server 3.5: changes from 3.3

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/lib/tdb/common/io.c

    r414 r456  
    9090                return -1;
    9191
     92#ifdef __OS2__
     93        // YD we must upgrade read locks to write locks (exclusive), otherwise
     94        // the owner (us) is not allowed to write to the file (different from unix)
     95        TDB_LOG((tdb, TDB_DEBUG_TRACE,"unlocking at %d len=%d before writing.\n", off, len));
     96        tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, 1);
     97        // if a wider previous lock is in effect, we cannot write lock our segment
     98        // (e.g. a lock_upgrade locks all the file), so we hope the previous lock
     99        // is a write lock: do not wait for lock.
     100        tdb_brlock( tdb, off, F_WRLCK, F_SETLK, 0, len);
     101#endif
     102
    92103        if (tdb->map_ptr) {
    93104                memcpy(off + (char *)tdb->map_ptr, buf, len);
     
    115126                                 "write %d bytes at %d in two attempts\n",
    116127                                 len, off));
    117                         return -1;
    118                 }
    119         }
     128
     129#ifdef __OS2__ // remove our lock
     130                        tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len);
     131#endif
     132                        return -1;
     133                }
     134        }
     135
     136#ifdef __OS2__ // remove our lock
     137        tdb_brlock( tdb, off, F_UNLCK, F_SETLK, 0, len);
     138#endif
     139
    120140        return 0;
    121141}
Note: See TracChangeset for help on using the changeset viewer.