aboutsummaryrefslogtreecommitdiff
path: root/crypto/key.go
diff options
context:
space:
mode:
authorJoe Richey <joerichey94@gmail.com>2017-08-29 11:17:10 -0700
committerJoe Richey <joerichey94@gmail.com>2017-08-29 11:17:10 -0700
commit7568ca2aab4a3266eb95cbda64298e2292743c7b (patch)
tree03f215c30237515f897c773fe7fbace4634bc48d /crypto/key.go
parenta14c0e8b896a1986bbd807ea60e3d7d05f5f6dfc (diff)
crypto: Handle when "ulimit -l" is too low
Diffstat (limited to 'crypto/key.go')
-rw-r--r--crypto/key.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/key.go b/crypto/key.go
index 99efc1a..ec37330 100644
--- a/crypto/key.go
+++ b/crypto/key.go
@@ -109,6 +109,9 @@ func newBlankKey(length int) (*Key, error) {
// See MAP_ANONYMOUS in http://man7.org/linux/man-pages/man2/mmap.2.html
data, err := unix.Mmap(-1, 0, length, keyProtection, flags)
+ if err == unix.EAGAIN {
+ return nil, ErrKeyLock
+ }
if err != nil {
log.Printf("unix.Mmap() with length=%d failed: %v", length, err)
return nil, ErrKeyAlloc