diff options
| author | David Nugent <davidn@FreeBSD.org> | 1997-02-10 16:32:03 +0000 |
|---|---|---|
| committer | David Nugent <davidn@FreeBSD.org> | 1997-02-10 16:32:03 +0000 |
| commit | e9039c38dc0e9cb9b255c4cd77c68e44e1067188 (patch) | |
| tree | e5ab74e751c67efd128d1a4c922b8514f7dd32e7 | |
| parent | 04a0d5e517f4d0a9431d68258d01e8514de6c707 (diff) | |
Notes
| -rw-r--r-- | lib/libutil/login_auth.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/libutil/login_auth.c b/lib/libutil/login_auth.c index a625b65fc7ec..6488785c2847 100644 --- a/lib/libutil/login_auth.c +++ b/lib/libutil/login_auth.c @@ -42,8 +42,6 @@ #include <paths.h> #include <sys/wait.h> -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) { |
