Handle os.chmod errors

This commit is contained in:
Ioannis Dressos 2023-10-29 16:17:40 +02:00 committed by GitHub
parent 2c60429724
commit 0de0edafb8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 59 additions and 16 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
}