From: Daniel Golle Date: Tue, 18 Sep 2018 11:29:10 +0000 (+0200) Subject: be more tolerant when reading key fingerprint X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=e1c722b1b6cbf2527b3178342464e56b97825874;p=oweals%2Fucert.git 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 --- 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';