瀏覽代碼

lockfile path

Matthew R. Kasun 3 年之前
父節點
當前提交
3a9f75cc83
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      netclient/functions/mqhandlers.go

+ 2 - 1
netclient/functions/mqhandlers.go

@@ -247,9 +247,10 @@ func UpdatePeers(client mqtt.Client, msg mqtt.Message) {
 func setHostDNS(dns, iface string, windows bool) error {
 	etchosts := "/etc/hosts"
 	temp := os.TempDir()
-	lockfile := temp + "netclient-lock"
+	lockfile := temp + "/netclient-lock"
 	if windows {
 		etchosts = "c:\\windows\\system32\\drivers\\etc\\hosts"
+		lockfile = temp + "\\netclient-lock"
 	}
 	if _, err := os.Stat(lockfile); !errors.Is(err, os.ErrNotExist) {
 		return errors.New("/etc/hosts file is locked .... aborting")