View | Details | Raw Unified | Return to bug 1869 | Differences between
and this patch

Collapse All | Expand All

(-)authfile.c (-2 / +5 lines)
Lines 317-323 Link Here
317
static int
317
static int
318
key_load_file(int fd, const char *filename, Buffer *blob)
318
key_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
Lines 337-347 Link Here
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 ? "" : " ",

Return to bug 1869