diff options
Diffstat (limited to 'source3/lib/tdb/common/lock.c')
-rw-r--r-- | source3/lib/tdb/common/lock.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source3/lib/tdb/common/lock.c b/source3/lib/tdb/common/lock.c index 22896f5227..43be5d20e1 100644 --- a/source3/lib/tdb/common/lock.c +++ b/source3/lib/tdb/common/lock.c @@ -27,6 +27,11 @@ #include "tdb_private.h" +void tdb_setalarm_sigptr(struct tdb_context *tdb, volatile sig_atomic_t *ptr) +{ + tdb->interrupt_sig_ptr = ptr; +} + /* a byte range locking function - return 0 on success this functions locks/unlocks 1 byte at the specified offset. @@ -58,6 +63,13 @@ int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, do { ret = fcntl(tdb->fd,lck_type,&fl); + + /* Check for a sigalarm break. */ + if (ret == -1 && errno == EINTR && + tdb->interrupt_sig_ptr && + *tdb->interrupt_sig_ptr) { + break; + } } while (ret == -1 && errno == EINTR); if (ret == -1) { |