From 0ffb0ceb64778fc34bd18ec12f38e09f7d454c0c Mon Sep 17 00:00:00 2001 From: Tess Gauthier Date: Mon, 16 Oct 2023 09:56:42 -0400 Subject: [PATCH] remove redundant WINDOWS preprocessor definitions (#697) --- ssh-pkcs11-client.c | 10 ++-------- ssh-sk-client.c | 10 ++-------- 2 files changed, 4 insertions(+), 16 deletions(-) diff --git a/ssh-pkcs11-client.c b/ssh-pkcs11-client.c index 3b49cc538..3266e4e44 100644 --- a/ssh-pkcs11-client.c +++ b/ssh-pkcs11-client.c @@ -165,20 +165,14 @@ find_helper(void) char module_path[PATH_MAX + 1]; char *ep; DWORD n; - -#ifdef WINDOWS size_t len = 0; + _dupenv_s(&helper, &len, "SSH_PKCS11_HELPER"); if (helper == NULL || len == 0) { if ((helper = find_helper_in_module_path()) == NULL) helper = _PATH_SSH_PKCS11_HELPER; } -#else - if ((helper = getenv("SSH_PKCS11_HELPER")) == NULL || strlen(helper) == 0) { - if ((helper = find_helper_in_module_path()) == NULL) - helper = _PATH_SSH_PKCS11_HELPER; - } -#endif /* WINDOWS */ + if (!path_absolute(helper)) { error_f("helper \"%s\" unusable: path not absolute", helper); return NULL; diff --git a/ssh-sk-client.c b/ssh-sk-client.c index b6a71dcc9..88b9e8c2e 100644 --- a/ssh-sk-client.c +++ b/ssh-sk-client.c @@ -84,20 +84,14 @@ find_helper(void) char module_path[PATH_MAX + 1]; char *ep; DWORD n; - -#ifdef WINDOWS size_t len = 0; + _dupenv_s(&helper, &len, "SSH_SK_HELPER"); if (helper == NULL || len == 0) { if ((helper = find_helper_in_module_path()) == NULL) helper = _PATH_SSH_SK_HELPER; } -#else - if ((helper = getenv("SSH_SK_HELPER")) == NULL || strlen(helper) == 0) { - if ((helper = find_helper_in_module_path()) == NULL) - helper = _PATH_SSH_SK_HELPER; - } -#endif /* WINDOWS */ + if (!path_absolute(helper)) { error_f("helper \"%s\" unusable: path not absolute", helper); return NULL;