squat-uidlist.c (dovecot-2.3.16) | : | squat-uidlist.c (dovecot-2.3.17) | ||
---|---|---|---|---|
skipping to change at line 603 | skipping to change at line 603 | |||
return -1; | return -1; | |||
} | } | |||
uidlist->locked_file_size = st2.st_size; | uidlist->locked_file_size = st2.st_size; | |||
return st.st_ino == st2.st_ino && | return st.st_ino == st2.st_ino && | |||
CMP_DEV_T(st.st_dev, st2.st_dev) ? 0 : 1; | CMP_DEV_T(st.st_dev, st2.st_dev) ? 0 : 1; | |||
} | } | |||
static int squat_uidlist_lock(struct squat_uidlist *uidlist) | static int squat_uidlist_lock(struct squat_uidlist *uidlist) | |||
{ | { | |||
const char *error; | ||||
int ret; | int ret; | |||
for (;;) { | for (;;) { | |||
i_assert(uidlist->fd != -1); | i_assert(uidlist->fd != -1); | |||
i_assert(uidlist->file_lock == NULL); | i_assert(uidlist->file_lock == NULL); | |||
i_assert(uidlist->dotlock == NULL); | i_assert(uidlist->dotlock == NULL); | |||
if (uidlist->trie->lock_method != FILE_LOCK_METHOD_DOTLOCK) { | if (uidlist->trie->lock_method != FILE_LOCK_METHOD_DOTLOCK) { | |||
struct file_lock_settings lock_set = { | ||||
.lock_method = uidlist->trie->lock_method, | ||||
}; | ||||
ret = file_wait_lock(uidlist->fd, uidlist->path, | ret = file_wait_lock(uidlist->fd, uidlist->path, | |||
F_WRLCK, | F_WRLCK, &lock_set, | |||
uidlist->trie->lock_method, | ||||
SQUAT_TRIE_LOCK_TIMEOUT, | SQUAT_TRIE_LOCK_TIMEOUT, | |||
&uidlist->file_lock); | &uidlist->file_lock, &error); | |||
if (ret < 0) { | ||||
i_error("squat uidlist %s: %s", | ||||
uidlist->path, error); | ||||
} | ||||
} else { | } else { | |||
ret = file_dotlock_create(&uidlist->trie->dotlock_set, | ret = file_dotlock_create(&uidlist->trie->dotlock_set, | |||
uidlist->path, 0, | uidlist->path, 0, | |||
&uidlist->dotlock); | &uidlist->dotlock); | |||
} | } | |||
if (ret == 0) { | if (ret == 0) { | |||
i_error("squat uidlist %s: Locking timed out", | i_error("squat uidlist %s: Locking timed out", | |||
uidlist->path); | uidlist->path); | |||
return 0; | return 0; | |||
} | } | |||
End of changes. 4 change blocks. | ||||
3 lines changed or deleted | 10 lines changed or added |