summaryrefslogtreecommitdiffstats
path: root/lib/libutil
diff options
context:
space:
mode:
authordavidn <davidn@FreeBSD.org>1997-02-10 16:32:03 +0000
committerdavidn <davidn@FreeBSD.org>1997-02-10 16:32:03 +0000
commite10e1c88f158f201589739205a2d8df8b8337d4e (patch)
treee5ab74e751c67efd128d1a4c922b8514f7dd32e7 /lib/libutil
parent88d81a4c46e1cc32600754cf7f8d24d1ee515e72 (diff)
downloadFreeBSD-src-e10e1c88f158f201589739205a2d8df8b8337d4e.zip
FreeBSD-src-e10e1c88f158f201589739205a2d8df8b8337d4e.tar.gz
Obsolete fgetline() -> fgetln(); and chop off newline if necessary.
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/login_auth.c9
1 files changed, 5 insertions, 4 deletions
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 <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) {
OpenPOWER on IntegriCloud