Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 19b52f6c9b |
@@ -16,6 +16,11 @@ func Flock(path string) (release func(), err error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
// REQ-139 / F15: tighten pre-existing looser perms to 0600.
|
||||||
|
// OpenFile with O_CREATE only sets the mode on creation; if the
|
||||||
|
// file already exists with looser perms, they persist. Chmod
|
||||||
|
// ensures 0600 regardless.
|
||||||
|
_ = os.Chmod(path, 0o600)
|
||||||
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil {
|
if err := syscall.Flock(int(f.Fd()), syscall.LOCK_EX); err != nil {
|
||||||
f.Close()
|
f.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user