Fix some problems found by Coverity analysis.

This commit is contained in:
Milan Broz
2017-09-27 10:18:38 +02:00
parent c1c541642e
commit 3ccbb8fe84
9 changed files with 40 additions and 35 deletions

View File

@@ -169,6 +169,7 @@ static void release_lock_handle(struct crypt_lock_handle *h)
char res[PATH_MAX];
struct stat buf_a, buf_b;
/* coverity[toctou] */
if (S_ISBLK(h->mode) && /* was it block device */
!flock(h->flock_fd, LOCK_EX | LOCK_NB) && /* lock to drop the file */
!resource_by_devno(res, sizeof(res), h->devno, 1) && /* acquire lock resource name */