Skip to content

Commit

Permalink
chore: enable prestart hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
nixpig committed Dec 8, 2024
1 parent 7aeb86c commit a0f85d0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions container/container_init.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -169,9 +170,10 @@ func (c *Container) Init(reexec string, arg string, log *zerolog.Logger) error {
}

if c.Spec.Process != nil && c.Spec.Process.Rlimits != nil {
if err := cgroups.SetRlimits(c.Spec.Process.Rlimits); err != nil {
log.Error().Err(err).Msg("set rlimits")
return err
for _, rl := range c.Spec.Process.Rlimits {
if _, ok := cgroups.Rlimits[rl.Type]; !ok {
return errors.New("unable to map rlimit to kernel interface")
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions container/container_reexec2.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package container

import (
"errors"
"fmt"
"os"
"os/exec"
Expand Down Expand Up @@ -71,9 +72,10 @@ func (c *Container) Reexec2(log *zerolog.Logger) error {

if c.Spec.Process != nil {
if c.Spec.Process.Rlimits != nil {
if err := cgroups.SetRlimits(c.Spec.Process.Rlimits); err != nil {
log.Error().Err(err).Msg("set rlimits")
return err
for _, rl := range c.Spec.Process.Rlimits {
if _, ok := cgroups.Rlimits[rl.Type]; !ok {
return errors.New("unable to map rlimit to kernel interface")
}
}
}

Expand Down

0 comments on commit a0f85d0

Please sign in to comment.