From e10e1c88f158f201589739205a2d8df8b8337d4e Mon Sep 17 00:00:00 2001 From: davidn Date: Mon, 10 Feb 1997 16:32:03 +0000 Subject: Obsolete fgetline() -> fgetln(); and chop off newline if necessary. --- lib/libutil/login_auth.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/libutil') diff --git a/lib/libutil/login_auth.c b/lib/libutil/login_auth.c index a625b65..6488785 100644 --- a/lib/libutil/login_auth.c +++ b/lib/libutil/login_auth.c @@ -42,8 +42,6 @@ #include #include -extern char *fgetline(FILE *, int*); - #ifdef RLIM_LONG # define STRTOV strtol #else @@ -121,14 +119,17 @@ collect_info(int fd) char *line; FILE *fp; char *ptr; - int len; + size_t len; int line_count = 0; fp = fdopen(fd, "r"); - while ((line = fgetline(fp, &len)) != NULL) { + while ((line = fgetln(fp, &len)) != NULL) { if (++line_count > AUTHMAXLINES) break; + if (len && line[len-1] == '\n') + --len; + line[len] = '\0'; /* Terminate */ if (strncasecmp(line, BI_REJECT, STRSIZEOF(BI_REJECT)) == 0) { auth_info.reject = 1; } else if (strncasecmp(line, BI_AUTH, STRSIZEOF(BI_AUTH)) == 0) { -- cgit v1.1