Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Feb 2021 12:40:37 GMT
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 410994f46335 - stable/13 - libc: remove open-coded strlen in _gettemp
Message-ID:  <202102011240.111CebIU094743@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mjg:

URL: https://cgit.FreeBSD.org/src/commit/?id=410994f463351fe2899af77c797dd61c772b02cf

commit 410994f463351fe2899af77c797dd61c772b02cf
Author:     Mateusz Guzik <mjg@FreeBSD.org>
AuthorDate: 2021-01-24 04:32:46 +0000
Commit:     Mateusz Guzik <mjg@FreeBSD.org>
CommitDate: 2021-02-01 12:39:15 +0000

    libc: remove open-coded strlen in _gettemp
    
    (cherry picked from commit 6fe328ace8f418bab0ab7f78c6fa1f2e757dd8a9)
---
 lib/libc/stdio/mktemp.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/lib/libc/stdio/mktemp.c b/lib/libc/stdio/mktemp.c
index f64eda748d0b..c47e0221e5cd 100644
--- a/lib/libc/stdio/mktemp.c
+++ b/lib/libc/stdio/mktemp.c
@@ -131,8 +131,7 @@ _gettemp(int dfd, char *path, int *doopen, int domkdir, int slen, int oflags)
 		return (0);
 	}
 
-	for (trv = path; *trv != '\0'; ++trv)
-		;
+	trv = path + strlen(path);
 	if (trv - path >= MAXPATHLEN) {
 		errno = ENAMETOOLONG;
 		return (0);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202102011240.111CebIU094743>