diff options
author | Gilles Chehade <gilles@cvs.openbsd.org> | 2007-10-05 19:28:24 +0000 |
---|---|---|
committer | Gilles Chehade <gilles@cvs.openbsd.org> | 2007-10-05 19:28:24 +0000 |
commit | 91be8bab3c8cdead892a30c54b7f364fb936ae7c (patch) | |
tree | 2a6d009cb6176dd7fbe0e5d09e2047f70b0b9766 /usr.bin/cvs/entries.c | |
parent | 16fbc333c2309760bf1d04d61e76b3e3d72cfba3 (diff) |
strcspn() change
was okay'd by pyr@ and ok by millert@
Diffstat (limited to 'usr.bin/cvs/entries.c')
-rw-r--r-- | usr.bin/cvs/entries.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index d1ac4eec8c3..a15f1908e37 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.83 2007/09/25 11:10:28 chl Exp $ */ +/* $OpenBSD: entries.c,v 1.84 2007/10/05 19:28:23 gilles Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -32,7 +32,6 @@ CVSENTRIES * cvs_ent_open(const char *dir) { FILE *fp; - size_t len; CVSENTRIES *ep; char *p, buf[MAXPATHLEN]; struct cvs_ent *ent; @@ -58,9 +57,7 @@ cvs_ent_open(const char *dir) if ((fp = fopen(ep->cef_path, "r")) != NULL) { while (fgets(buf, sizeof(buf), fp)) { - len = strlen(buf); - if (len > 0 && buf[len - 1] == '\n') - buf[len - 1] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; if (buf[0] == 'D' && buf[1] == '\0') break; @@ -75,9 +72,7 @@ cvs_ent_open(const char *dir) if ((fp = fopen(ep->cef_lpath, "r")) != NULL) { while (fgets(buf, sizeof(buf), fp)) { - len = strlen(buf); - if (len > 0 && buf[len - 1] == '\n') - buf[len - 1] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; p = &buf[1]; |