summaryrefslogtreecommitdiff
path: root/authfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'authfile.c')
-rw-r--r--authfile.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/authfile.c b/authfile.c
index be650af67..2ed250232 100644
--- a/authfile.c
+++ b/authfile.c
@@ -317,7 +317,7 @@ key_parse_public_rsa1(Buffer *blob, char **commentp)
317static int 317static int
318key_load_file(int fd, const char *filename, Buffer *blob) 318key_load_file(int fd, const char *filename, Buffer *blob)
319{ 319{
320 size_t len; 320 size_t len, readcount;
321 u_char *cp; 321 u_char *cp;
322 struct stat st; 322 struct stat st;
323 323
@@ -337,11 +337,14 @@ key_load_file(int fd, const char *filename, Buffer *blob)
337 return 0; 337 return 0;
338 } 338 }
339 len = (size_t)st.st_size; /* truncated */ 339 len = (size_t)st.st_size; /* truncated */
340 if (0 == len && S_ISFIFO(st.st_mode))
341 len = 8192; /* we will try reading up to 8KiB from a FIFO */
340 342
341 buffer_init(blob); 343 buffer_init(blob);
342 cp = buffer_append_space(blob, len); 344 cp = buffer_append_space(blob, len);
343 345
344 if (atomicio(read, fd, cp, len) != len) { 346 readcount = atomicio(read, fd, cp, len);
347 if (readcount != len && !(readcount > 0 && S_ISFIFO(st.st_mode))) {
345 debug("%s: read from key file %.200s%sfailed: %.100s", __func__, 348 debug("%s: read from key file %.200s%sfailed: %.100s", __func__,
346 filename == NULL ? "" : filename, 349 filename == NULL ? "" : filename,
347 filename == NULL ? "" : " ", 350 filename == NULL ? "" : " ",