Skip to content

Commit

Permalink
Update wifi.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Jun 27, 2023
1 parent fb286bb commit 0465952
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions wap/pkg/wifi/wifi.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"runtime"
"strings"
Expand Down Expand Up @@ -203,7 +202,7 @@ func getWifiConnections(ctx context.Context) ([]string, error) {
func readWiFiPasswordFromFile(connectionName string) (string, error) {
cfg, err := ini.Load(fmt.Sprintf("/etc/NetworkManager/system-connections/%s.nmconnection", connectionName))
if err != nil {
return "", fmt.Errorf("Failed to read file: %v", err)
return "", fmt.Errorf("failed to read file: %v", err)
}

psk := cfg.Section("wifi-security").Key("psk").String()
Expand Down Expand Up @@ -236,7 +235,7 @@ func connectToFirstWifi(ctx context.Context, connections []string) error {
}

// Create a temporary file
tempFile, err := ioutil.TempFile("", "passwd-")
tempFile, err := os.CreateTemp("", "passwd-")
if err != nil {
return fmt.Errorf("failed to create temporary file: %w", err)
}
Expand Down

0 comments on commit 0465952

Please sign in to comment.