aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2023-05-31 07:47:36 +0000
committerNIIBE Yutaka <[email protected]>2023-05-31 07:47:36 +0000
commitc69578bc248ee18d3a35d33e0d18d17bebbe99b4 (patch)
treefec5363dad130a102ecf02a69b3f6412f7529a20
parentw32: Fix error return for sending fd. (diff)
downloadlibassuan-c69578bc248ee18d3a35d33e0d18d17bebbe99b4.tar.gz
libassuan-c69578bc248ee18d3a35d33e0d18d17bebbe99b4.zip
w32: Always include process information in HELLO.
* src/assuan-listen.c (assuan_accept): Supply process information when ctx->hello is avaliable, too. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--src/assuan-listen.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/src/assuan-listen.c b/src/assuan-listen.c
index 93560ff..6968420 100644
--- a/src/assuan-listen.c
+++ b/src/assuan-listen.c
@@ -77,6 +77,8 @@ assuan_accept (assuan_context_t ctx)
{
gpg_error_t rc = 0;
const char *p, *pend;
+ pid_t apid = getpid ();
+ char tmpbuf[50];
if (!ctx)
return _assuan_error (ctx, GPG_ERR_ASS_INV_VALUE);
@@ -110,17 +112,34 @@ assuan_accept (assuan_context_t ctx)
pend = strchr (p, '\n');
}
while (pend);
- rc = _assuan_write_line (ctx, "OK ", p, strlen (p));
+#if defined(HAVE_W32_SYSTEM)
+ if (apid != ASSUAN_INVALID_PID)
+ {
+ snprintf (tmpbuf, sizeof tmpbuf, "%s, process %i", p, (int)apid);
+ rc = _assuan_write_line (ctx, "OK ", tmpbuf, strlen (tmpbuf));
+ }
+ else
+#endif
+ rc = _assuan_write_line (ctx, "OK ", p, strlen (p));
+
}
else if (p)
- rc = assuan_write_line (ctx, p);
+ {
+#if defined(HAVE_W32_SYSTEM)
+ if (apid != ASSUAN_INVALID_PID)
+ {
+ snprintf (tmpbuf, sizeof tmpbuf, "%s, process %i", p, (int)apid);
+ rc = assuan_write_line (ctx, tmpbuf);
+ }
+ else
+#endif
+ rc = assuan_write_line (ctx, p);
+ }
else
{
static char const okstr[] = "OK Pleased to meet you";
- pid_t apid = getpid ();
if (apid != ASSUAN_INVALID_PID)
{
- char tmpbuf[50];
snprintf (tmpbuf, sizeof tmpbuf, "%s, process %i", okstr, (int)apid);
rc = assuan_write_line (ctx, tmpbuf);
}