Properly terminate pinentry protocol (BYE)

This isn't strictly necessary on unix-like systems since it will exit
when the pipes are closed. Unfortunately Windows isn't so nice and neat
and the program will remain open indefinitely even though its inputs and
outputs have been closed. So ask pinentry to terminate gracefully.
pull/28/head
Christopher Wellons 2020-05-18 19:09:22 -04:00
parent 50624f2373
commit 32d4d99472
1 changed files with 3 additions and 0 deletions

View File

@ -495,6 +495,9 @@ pinentry(FILE *pfi, FILE *pfo, char *buf, size_t len, char *prompt)
pinentry_decode(buf, len, line + 2);
else
fatal("pinentry protocol failure");
if (fprintf(pfi, "BYE\n") < 0 || fflush(pfi) < 0)
fatal("pinentry write() -- %s", strerror(errno));
}
#if defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__)