Skip to content

Commit

Permalink
libcontainer/notify_linux*: adjust the file mode
Browse files Browse the repository at this point in the history
This commit adjusts the file mode to use the latest golang style
In addition to that, I changed those modes from 0700 to 0600
as same as opencontainers#2636

Related to opencontainers#2625

Signed-off-by: Kenta Tada <[email protected]>
  • Loading branch information
Kenta Tada authored and Kenta Tada committed Mar 8, 2021
1 parent 59ad417 commit 368fc5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libcontainer/notify_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func registerMemoryEvent(cgDir string, evName string, arg string) (<-chan struct

eventControlPath := filepath.Join(cgDir, "cgroup.event_control")
data := fmt.Sprintf("%d %d %s", eventfd.Fd(), evFile.Fd(), arg)
if err := ioutil.WriteFile(eventControlPath, []byte(data), 0700); err != nil {
if err := ioutil.WriteFile(eventControlPath, []byte(data), 0o600); err != nil {
eventfd.Close()
evFile.Close()
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions libcontainer/notify_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ func testMemoryNotification(t *testing.T, evName string, notify notifyFunc, targ
}
evFile := filepath.Join(memoryPath, evName)
eventPath := filepath.Join(memoryPath, "cgroup.event_control")
if err := ioutil.WriteFile(evFile, []byte{}, 0700); err != nil {
if err := ioutil.WriteFile(evFile, []byte{}, 0o600); err != nil {
t.Fatal(err)
}
if err := ioutil.WriteFile(eventPath, []byte{}, 0700); err != nil {
if err := ioutil.WriteFile(eventPath, []byte{}, 0o600); err != nil {
t.Fatal(err)
}
ch, err := notify(memoryPath)
Expand Down

0 comments on commit 368fc5d

Please sign in to comment.