comparison dbutil.c @ 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 2e9d1f29c50f
children a0db9a23f6d4
comparison
equal deleted inserted replaced
116:2010f4119c1a 117:e0acad552a92
504 * ignore that line */ 504 * ignore that line */
505 buf_setlen(line, 0); 505 buf_setlen(line, 0);
506 506
507 out: 507 out:
508 508
509 buf_setpos(line, 0);
510 509
511 /* if we didn't read anything before EOF or error, exit */ 510 /* if we didn't read anything before EOF or error, exit */
512 if (c == EOF && line->pos == 0) { 511 if (c == EOF && line->pos == 0) {
513 TRACE(("leave getauthline: failure")); 512 TRACE(("leave buf_getline: failure"));
514 return DROPBEAR_FAILURE; 513 return DROPBEAR_FAILURE;
515 } else { 514 } else {
516 TRACE(("leave getauthline: success")); 515 TRACE(("leave buf_getline: success"));
516 buf_setpos(line, 0);
517 return DROPBEAR_SUCCESS; 517 return DROPBEAR_SUCCESS;
518 } 518 }
519 519
520 TRACE(("leave buf_getline"));
521 } 520 }
522 #endif 521 #endif
523 522
524 /* loop until the socket is closed (in case of EINTR) or 523 /* loop until the socket is closed (in case of EINTR) or
525 * we get and error. 524 * we get and error.