mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 10:16:41 +00:00
locks: Check syscalls return values in lock probing
travis-ci: success for series starting with [1/1] locks: Check syscalls return values in lock probing Signed-off-by: Pavel Begunkov <asml.silence@gmail.com> Signed-off-by: Eugene Batalov <eabatalov89@gmail.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
parent
52a047ba27
commit
b504ec5c77
1 changed files with 11 additions and 3 deletions
|
|
@ -197,9 +197,13 @@ static int lock_check_fd(int lfd, struct file_lock *fl)
|
|||
*/
|
||||
pr_debug(" `- downgrading lock back\n");
|
||||
if (fl->fl_ltype & LOCK_MAND)
|
||||
flock(lfd, fl->fl_ltype);
|
||||
ret = flock(lfd, fl->fl_ltype);
|
||||
else if (fl->fl_ltype == F_RDLCK)
|
||||
flock(lfd, LOCK_SH);
|
||||
ret = flock(lfd, LOCK_SH);
|
||||
if (ret) {
|
||||
pr_err("Can't downgrade lock back %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
@ -250,7 +254,11 @@ static int lock_ofd_check_fd(int lfd, struct file_lock *fl)
|
|||
else
|
||||
lck.l_type = F_RDLCK;
|
||||
|
||||
fcntl(lfd, F_OFD_SETLK, &lck);
|
||||
ret = fcntl(lfd, F_OFD_SETLK, &lck);
|
||||
if (ret) {
|
||||
pr_err("Can't downgrade lock back %d\n", ret);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue