fix: typos
This commit is contained in:
parent
5acde57e11
commit
9ce23a6488
|
@ -5,10 +5,9 @@ package aghos
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"strings"
|
||||||
|
|
||||||
"github.com/AdguardTeam/golibs/errors"
|
"github.com/AdguardTeam/golibs/errors"
|
||||||
"github.com/AdguardTeam/golibs/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// protectedDirectories are directories which contain other application binaries,
|
// protectedDirectories are directories which contain other application binaries,
|
||||||
|
@ -16,9 +15,9 @@ import (
|
||||||
// overwriting other files. Moreover, these directories are innapproriate for storage of
|
// overwriting other files. Moreover, these directories are innapproriate for storage of
|
||||||
// config files or session storage.
|
// config files or session storage.
|
||||||
var protectedDirectories = []string{
|
var protectedDirectories = []string{
|
||||||
"/usr/bin"
|
"/usr/bin",
|
||||||
"/usr/sbin"
|
"/usr/sbin",
|
||||||
"/user/bin"
|
"/user/bin",
|
||||||
}
|
}
|
||||||
|
|
||||||
// serviceInstallDir is a executable path in a directory which secure permissions
|
// serviceInstallDir is a executable path in a directory which secure permissions
|
||||||
|
@ -52,11 +51,10 @@ func SecureBinary() error {
|
||||||
return fmt.Errorf("os.Chmod() %q: %w", binary, err)
|
return fmt.Errorf("os.Chmod() %q: %w", binary, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Move binary to the PATH in a folder which is read-only to non root users
|
// Move binary to the PATH in a folder which is read-only to non root users
|
||||||
// If already moved, this is a no-op
|
// If already moved, this is a no-op
|
||||||
if err := os.Rename(binary, serviceInstallDir); err != nil {
|
if err := os.Rename(binary, serviceInstallDir); err != nil {
|
||||||
return fmt.Errorf("os.Rename() %q to %q: %w", binary, installDir, err)
|
return fmt.Errorf("os.Rename() %q to %q: %w", binary, serviceInstallDir, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -67,7 +65,7 @@ func SecureBinary() error {
|
||||||
func CurrentDirAvaliable() (bool, error) {
|
func CurrentDirAvaliable() (bool, error) {
|
||||||
binary, err := os.Executable()
|
binary, err := os.Executable()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("os.Executable(): %w", err)
|
return false, fmt.Errorf("os.Executable(): %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for i := 0; i < len(protectedDirectories); i++ {
|
for i := 0; i < len(protectedDirectories); i++ {
|
||||||
|
|
Loading…
Reference in New Issue