From e0e3daba329d5f0952fb6aee6c3ba0ff035391e8 Mon Sep 17 00:00:00 2001 From: therealpaulgg Date: Sun, 19 Mar 2023 17:40:55 -0700 Subject: [PATCH] truncate files --- pkg/utils/write.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/utils/write.go b/pkg/utils/write.go index 8cf3d75..7480856 100644 --- a/pkg/utils/write.go +++ b/pkg/utils/write.go @@ -22,7 +22,7 @@ func WriteConfig(hosts []models.Host) error { return err } } - file, err := os.OpenFile(filepath.Join(p, "config"), os.O_WRONLY|os.O_CREATE, 0644) + file, err := os.OpenFile(filepath.Join(p, "config"), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) if err != nil { return err } @@ -60,7 +60,7 @@ func WriteKey(key []byte, filename string) error { return err } } - file, err := os.OpenFile(filepath.Join(p, filename), os.O_WRONLY|os.O_CREATE, 0600) + file, err := os.OpenFile(filepath.Join(p, filename), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0600) if err != nil { return err }