From 8cd4441a448bfa7a0140bd6ffaf5402caabc8277 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 29 Jul 2024 02:58:22 +0200 Subject: [PATCH] fix: solve build issues on windows --- src/m_pinentry/pinentry.cpp | 69 +++---------------------------------- src/m_pinentry/pinentry.h | 2 ++ 2 files changed, 6 insertions(+), 65 deletions(-) diff --git a/src/m_pinentry/pinentry.cpp b/src/m_pinentry/pinentry.cpp index 072fa6c..c2965a8 100644 --- a/src/m_pinentry/pinentry.cpp +++ b/src/m_pinentry/pinentry.cpp @@ -18,36 +18,13 @@ * SPDX-License-Identifier: GPL-2.0+ */ -#include "GFModuleCommonUtils.hpp" -#include "GFSDKBasic.h" - -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifndef WINDOWS -#include -#endif -#include -#include -#include -#include -#include -#include -#ifndef WINDOWS -#include -#endif -#ifndef WINDOWS -#include -#endif -#include -#ifdef WINDOWS -#include -#endif +#include "pinentry.h" #include +#include -#include "pinentry.h" +#include "GFModuleCommonUtils.hpp" +#include "GFSDKBasic.h" #ifdef WINDOWS #define getpid() GetCurrentProcessId() @@ -136,44 +113,6 @@ static char *get_pid_name_for_uid(unsigned long pid, int uid) { const char *pinentry_get_pgmname(void) { return this_pgmname; } -/* Return a malloced string with the title. The caller mus free the - * string. If no title is available or the title string has an error - * NULL is returned. */ -char *pinentry_get_title(pinentry_t pe) { - char *title; - - if (pe->title) title = strdup(pe->title); -#ifndef WINDOWS - else if (pe->owner_pid) { - char buf[200]; - struct utsname utsbuf; - char *pidname = NULL; - char *cmdline = NULL; - - if (pe->owner_host && !uname(&utsbuf) && - !strcmp(utsbuf.nodename, pe->owner_host)) { - pidname = get_pid_name_for_uid(pe->owner_pid, pe->owner_uid); - if (pidname) cmdline = get_cmdline(pe->owner_pid); - } - - if (pe->owner_host && (cmdline || pidname)) - snprintf(buf, sizeof buf, "[%lu]@%s (%s)", pe->owner_pid, pe->owner_host, - cmdline ? cmdline : pidname); - else if (pe->owner_host) - snprintf(buf, sizeof buf, "[%lu]@%s", pe->owner_pid, pe->owner_host); - else - snprintf(buf, sizeof buf, "[%lu] ", pe->owner_pid); - free(pidname); - free(cmdline); - title = strdup(buf); - } -#endif /*!WINDOWS*/ - else - title = strdup(this_pgmname); - - return title; -} - /* Run a quality inquiry for PASSPHRASE of LENGTH. (We need LENGTH because not all backends might be able to return a proper C-string.). Returns: A value between -100 and 100 to give an diff --git a/src/m_pinentry/pinentry.h b/src/m_pinentry/pinentry.h index 143a885..5c38c68 100644 --- a/src/m_pinentry/pinentry.h +++ b/src/m_pinentry/pinentry.h @@ -21,6 +21,8 @@ #ifndef PINENTRY_H #define PINENTRY_H +#include + #include #ifdef __cplusplus