summaryrefslogtreecommitdiff
path: root/libexec/identd/parse.c
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2007-09-26 02:50:37 +0000
committerRay Lai <ray@cvs.openbsd.org>2007-09-26 02:50:37 +0000
commitd31da416a6ddee3fce0eaf390491c9fb1e633f57 (patch)
tree26eaeacd977340a3c16da4d90861be371419000d /libexec/identd/parse.c
parent40b760dbca92959c0b43e9ee3303e5130b5bccfb (diff)
From Tamas TEVESZ:
- Use strcspn to strip \r and \n. OK chl.
Diffstat (limited to 'libexec/identd/parse.c')
-rw-r--r--libexec/identd/parse.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libexec/identd/parse.c b/libexec/identd/parse.c
index 6947ef830fe..dd4c3e11a8a 100644
--- a/libexec/identd/parse.c
+++ b/libexec/identd/parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: parse.c,v 1.44 2007/03/21 03:32:28 tedu Exp $ */
+/* $OpenBSD: parse.c,v 1.45 2007/09/26 02:50:36 ray Exp $ */
/*
* This program is in the public domain and may be used freely by anyone
@@ -62,7 +62,7 @@ check_noident(char *homedir)
int
getuserident(char *homedir, char *buf, int len)
{
- char path[MAXPATHLEN], *p;
+ char path[MAXPATHLEN];
int fd, nread, n;
struct stat st;
@@ -87,8 +87,7 @@ getuserident(char *homedir, char *buf, int len)
buf[nread] = '\0';
/* remove illegal characters */
- if ((p = strpbrk(buf, "\r\n")))
- *p = '\0';
+ buf[strcspn(buf, "\r\n")] = '\0';
close(fd);
return 1;