Address lingering review comments from SHM locking PR

Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:
Matthew Heon
2019-01-04 14:15:08 -05:00
parent a219431a31
commit eba89259a5
4 changed files with 17 additions and 6 deletions

View File

@ -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
}