libcontainer/notify_linux*: adjust the file mode#2837
libcontainer/notify_linux*: adjust the file mode#2837KentaTada wants to merge 1 commit intoopencontainers:mainfrom
Conversation
| 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 { |
There was a problem hiding this comment.
-
In fact it does not matter what the mode here is, as the file exists (and it can't possibly be created as this is cgroupfs).
-
Might make sense to switch to
fscommon.WriteFilehere.
There was a problem hiding this comment.
I'll try to switch to fscommon.WriteFile.
It's a great way.
|
Would be nice to switch to |
368fc5d to
90375b0
Compare
|
Wondering if these should be moved into |
| const cgEvCtlFile = "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 := fscommon.WriteFile(cgDir, "cgroup.event_control", data); err != nil { |
There was a problem hiding this comment.
This should be
| if err := fscommon.WriteFile(cgDir, "cgroup.event_control", data); err != nil { | |
| if err := fscommon.WriteFile(cgDir, cgEvCtlFile, data); err != nil { |
90375b0 to
debb300
Compare
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 <Kenta.Tada@sony.com>
debb300 to
a41b75d
Compare
|
I'm not familiar with the current implementations but I think openFile() checks whether the actual cgropfs is used. |
| @@ -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") | |||
There was a problem hiding this comment.
Should this also use the const? (cgEvCtlFile)
|
Since this file already exists, the |
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 #2636
Related to #2625
Signed-off-by: Kenta Tada Kenta.Tada@sony.com