mirror of
https://github.com/containers/podman.git
synced 2025-08-06 11:32:07 +08:00
Address lingering review comments from SHM locking PR
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
@ -3,7 +3,10 @@
|
||||
package lock
|
||||
|
||||
import (
|
||||
"syscall"
|
||||
|
||||
"github.com/containers/libpod/libpod/lock/shm"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// SHMLockManager manages shared memory locks.
|
||||
@ -60,6 +63,11 @@ func (m *SHMLockManager) RetrieveLock(id uint32) (Locker, error) {
|
||||
lock.lockID = id
|
||||
lock.manager = m
|
||||
|
||||
if id >= m.locks.GetMaxLocks() {
|
||||
return nil, errors.Wrapf(syscall.EINVAL, "lock ID %d is too large - max lock size is %d",
|
||||
id, m.locks.GetMaxLocks()-1)
|
||||
}
|
||||
|
||||
return lock, nil
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user