diff --git a/src/utility/gpg-utils.sh b/src/utility/gpg-utils.sh index 89031459..c75735d5 100644 --- a/src/utility/gpg-utils.sh +++ b/src/utility/gpg-utils.sh @@ -276,7 +276,10 @@ function getSaveGpgHomedir() { local -ra params=(gpgDir) parseFnArgs params "$@" || return $? - if ((${#gpgDir} < 100)); then + # socket path max is on certain systems 108 - longest socket name which is currently S.gpg-agent.browser (20 chars) + # 108 - 20 = 88 - 1 (NUL terminating char) 87 and to be on the safer side we use 85 + local -r maxSocketPathLength=85 + if ((${#gpgDir} <= maxSocketPathLength)); then echo "$gpgDir" else local tmpDir