changeset 117:e0acad552a92 private-rez

Read the last line of a file without a finishing '\n' correctly
author Matt Johnston <matt@ucc.asn.au>
date Thu, 02 Sep 2004 18:36:11 +0000
parents 2010f4119c1a
children 5312ca05ed48 18b261b1dea2
files dbutil.c
diffstat 1 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dbutil.c	Thu Sep 02 15:24:17 2004 +0000
+++ b/dbutil.c	Thu Sep 02 18:36:11 2004 +0000
@@ -506,18 +506,17 @@
 
 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