From 91612b9d26129a9152a1e1c08602e5d758063255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= Date: Fri, 15 Mar 2024 15:29:44 +0100 Subject: [PATCH] Fix error checking --- browserbiometrics/main.go | 40 +++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/browserbiometrics/main.go b/browserbiometrics/main.go index 0abf918..b65b8d4 100644 --- a/browserbiometrics/main.go +++ b/browserbiometrics/main.go @@ -112,10 +112,22 @@ func detectAndInstallBrowsers(startPath string) error { fmt.Printf("Found mozilla-like browser: %s\n", path) fmt.Println("Removing old manifest and proxy script") - os.Chown(path+"/com.8bit.bitwarden.json", 7, 7) - os.Remove(path + "/com.8bit.bitwarden.json") - os.Chown(path+"/goldwarden-proxy.sh", 7, 7) - os.Remove(path + "/goldwarden-proxy.sh") + err = os.Chown(path+"/com.8bit.bitwarden.json", 7, 7) + if err != nil { + return err + } + err = os.Remove(path + "/com.8bit.bitwarden.json") + if err != nil { + return err + } + err = os.Chown(path+"/goldwarden-proxy.sh", 7, 7) + if err != nil { + return err + } + err = os.Remove(path + "/goldwarden-proxy.sh") + if err != nil { + return err + } fmt.Println("Writing new manifest") manifest := strings.Replace(templateMozilla, "PATH", path+"/goldwarden-proxy.sh", 1) @@ -133,10 +145,22 @@ func detectAndInstallBrowsers(startPath string) error { fmt.Printf("Found chrome-like browser: %s\n", path) fmt.Println("Removing old manifest and proxy script") - os.Chown(path+"/com.8bit.bitwarden.json", 7, 7) - os.Remove(path + "/com.8bit.bitwarden.json") - os.Chown(path+"/goldwarden-proxy.sh", 7, 7) - os.Remove(path + "/goldwarden-proxy.sh") + err = os.Chown(path+"/com.8bit.bitwarden.json", 7, 7) + if err != nil { + return err + } + err = os.Remove(path + "/com.8bit.bitwarden.json") + if err != nil { + return err + } + err = os.Chown(path+"/goldwarden-proxy.sh", 7, 7) + if err != nil { + return err + } + err = os.Remove(path + "/goldwarden-proxy.sh") + if err != nil { + return err + } fmt.Println("Writing new manifest") manifest := strings.Replace(templateChrome, "PATH", path+"/goldwarden-proxy.sh", 1)