fix: replace syscall.O_NOFOLLOW with utils.OpenFileSecure for Windows (pull/5764) (#5776)
This commit is contained in:
@@ -15,11 +15,10 @@
|
||||
package toml
|
||||
|
||||
import (
|
||||
"github.com/beego/beego/v2/core/utils"
|
||||
"github.com/pelletier/go-toml"
|
||||
"os"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/pelletier/go-toml"
|
||||
|
||||
"github.com/beego/beego/v2/core/config"
|
||||
)
|
||||
@@ -308,7 +307,7 @@ func (c *configContainer) OnChange(key string, fn func(value string)) {
|
||||
// SaveConfigFile create or override the file
|
||||
func (c *configContainer) SaveConfigFile(filename string) error {
|
||||
// Write configuration file by filename.
|
||||
f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|syscall.O_NOFOLLOW, 0600)
|
||||
f, err := utils.OpenFileSecure(filename, os.O_RDWR|os.O_CREATE, 0600)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user