fix: handle os.chmod errors

This commit is contained in:
Cameron 2023-10-14 10:38:59 -07:00
parent b55543f424
commit 5416d6e2af
3 changed files with 58 additions and 15 deletions

View file

@ -4,8 +4,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/ngoduykhanh/wireguard-ui/store"
"golang.org/x/mod/sumdb/dirhash"
"io"
"io/fs"
"io/ioutil"
@ -19,6 +17,9 @@ import (
"text/template"
"time"
"github.com/ngoduykhanh/wireguard-ui/store"
"golang.org/x/mod/sumdb/dirhash"
externalip "github.com/glendc/go-external-ip"
"github.com/labstack/gommon/log"
"github.com/ngoduykhanh/wireguard-ui/model"
@ -540,3 +541,8 @@ func RandomString(length int) string {
}
return string(b)
}
func ManagePerms(path string) error {
err := os.Chmod(path, 0600)
return err
}