From 7ed5870ed9e2be7cde050eafcdd778d6fce8540c Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Thu, 2 Sep 2004 18:36:11 +0000 Subject: [PATCH] Read the last line of a file without a finishing '\n' correctly --HG-- branch : private-rez extra : convert_revision : f64591461a40d54a2bd2e12493253ec76eab1ff2 --- dbutil.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/dbutil.c b/dbutil.c index c126a2f..4036841 100644 --- a/dbutil.c +++ b/dbutil.c @@ -506,18 +506,17 @@ int buf_getline(buffer * line, FILE * authfile) { out: - buf_setpos(line, 0); /* if we didn't read anything before EOF or error, exit */ if (c == EOF && line->pos == 0) { - TRACE(("leave getauthline: failure")); + TRACE(("leave buf_getline: failure")); return DROPBEAR_FAILURE; } else { - TRACE(("leave getauthline: success")); + TRACE(("leave buf_getline: success")); + buf_setpos(line, 0); return DROPBEAR_SUCCESS; } - TRACE(("leave buf_getline")); } #endif