Merge pull request #324 from projectdiscovery/fix-file-overrite

Fixed version file overrite issue with garbage during updates
master
bauthard 2020-09-21 13:42:21 +05:30 committed by GitHub
commit 9ac39687a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ func CheckConfigExists(configPath string) bool {
// MarshalWrite writes the marshaled yaml config to disk // MarshalWrite writes the marshaled yaml config to disk
func (c *ConfigFile) MarshalWrite(file string) error { func (c *ConfigFile) MarshalWrite(file string) error {
f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE, 0755) f, err := os.OpenFile(file, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0755)
if err != nil { if err != nil {
return err return err
} }