From 13c651c21f768fcb243adff2a24e2259057e9748 Mon Sep 17 00:00:00 2001 From: "florian on nixos (Florian Brandes)" Date: Wed, 10 Nov 2021 18:40:59 +0100 Subject: [PATCH] partly fixes #1. Check path of pinentry. Up until now pinentry_others returned the path of pinentry as it is returned by gpgconf. Unfortunately this is hard-coded and sometimes not correct. This commit adds a check for the path and falls back to the old behviour (return pinentry from PATH). Signed-off-by: florian on nixos (Florian Brandes) --- pinentry_others.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pinentry_others.go b/pinentry_others.go index 4a60e38..a0380f8 100644 --- a/pinentry_others.go +++ b/pinentry_others.go @@ -2,12 +2,18 @@ package pinentry -import "github.com/gopasspw/pinentry/gpgconf" +import ( + "github.com/gopasspw/pinentry/gpgconf" + "os/exec" +) // GetBinary returns the binary name func GetBinary() string { if p, err := gpgconf.Path("pinentry"); err == nil && p != "" { - return p + // check, whether the returned path acutally exists + if _, err := exec.LookPath(p); err == nil { + return p + } } return "pinentry" }