From e1c722b1b6cbf2527b3178342464e56b97825874 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 18 Sep 2018 13:29:10 +0200 Subject: [PATCH] be more tolerant when reading key fingerprint usign occasionally writes 16 characters then exits without writing a LF, leaving ucert hanging waiting for more input. Accept 16 characters or more rather than 17 to work around the short read. Signed-off-by: Mike McCormack Signed-off-by: Daniel Golle --- usign-exec.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usign-exec.c b/usign-exec.c index 21a24c2..949e83e 100644 --- a/usign-exec.c +++ b/usign-exec.c @@ -156,9 +156,10 @@ static int usign_f(char *fingerprint, const char *pubkeyfile, const char *seckey waitpid(pid, &status, 0); status = WEXITSTATUS(status); if (fingerprint && !WEXITSTATUS(status)) { + ssize_t r; memset(fingerprint, 0, 17); - read(fds[0], fingerprint, 17); - if (fingerprint[16] != '\n') + r = read(fds[0], fingerprint, 17); + if (r < 16) status = -1; fingerprint[16] = '\0'; -- 2.25.1