Changeset 847 for branches/samba-3.5.x/lib/tdb/common/open.c
- Timestamp:
- Feb 14, 2014, 7:01:54 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.5.x/lib/tdb/common/open.c
r836 r847 231 231 } 232 232 233 #ifdef __OS2__ 234 if (os2_crtSem(tdb, name, "tdb_open_ex") != 0) 235 goto fail; 236 #endif 237 233 238 if ((tdb->fd = open(name, open_flags, mode)) == -1) { 234 239 TDB_LOG((tdb, TDB_DEBUG_WARNING, "tdb_open_ex: could not open file %s: %s\n", … … 367 372 { int save_errno = errno; 368 373 374 #ifdef __OS2__ 375 DosCloseMutexSem(tdb->hActiveLock); 376 tdb->hActiveLock = 0; 377 #endif 369 378 if (!tdb) 370 379 return NULL; … … 434 443 } 435 444 445 #ifdef __OS2__ 446 DosCloseMutexSem(tdb->hActiveLock); 447 tdb->hActiveLock = 0; 448 #endif 449 436 450 #ifdef TDB_TRACE 437 451 close(tdb->tracefd); … … 500 514 tdb_mmap(tdb); 501 515 #endif /* fake pread or pwrite */ 516 517 #ifdef __OS2__ 518 DosCloseMutexSem(tdb->hActiveLock); 519 tdb->hActiveLock = 0; 520 521 if (os2_crtSem(tdb, tdb->name, "tdb_reopen") != 0) 522 goto fail; 523 #endif 502 524 503 525 if (active_lock && … … 551 573 return 0; 552 574 } 575 #ifdef __OS2__ 576 int os2_crtSem(struct tdb_context *tdb, const char *name, const char *caller) 577 { 578 // name could be null, so handle it 579 if (name == NULL) 580 return -1; 581 582 char szSem[_MAX_PATH]; 583 char drive[_MAX_DRIVE], dir[_MAX_DIR]; 584 char fname[_MAX_FNAME], ext[_MAX_EXT]; 585 APIRET rc; 586 // extract path info 587 _splitpath(name, drive, dir, fname, ext); 588 sprintf(szSem, "\\SEM32\\TDB_AL_%s%s%s", dir, fname, ext); 589 rc = DosCreateMutexSem(szSem, &tdb->hActiveLock, 0, FALSE); 590 if (rc == ERROR_DUPLICATE_NAME) 591 rc = DosOpenMutexSem(szSem, &tdb->hActiveLock); 592 if (rc != NO_ERROR) { 593 TDB_LOG((tdb, TDB_DEBUG_ERROR, "os2_crtSem: cannot create sem32 %s (rc=%d) called from %s\n", 594 szSem, rc, caller)); 595 errno = EINVAL; 596 return -1; 597 } 598 return 0; 599 } 600 #endif
Note:
See TracChangeset
for help on using the changeset viewer.