From ad7ba32b2d28af951447f332284879d98237bbe3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 4 May 2004 10:54:06 +0000 Subject: * path.cc (check_sysfile): Don't scan string twice. --- winsup/cygwin/path.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 59e454bfc..052749122 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -2786,8 +2786,9 @@ check_sysfile (const char *path, DWORD fileattr, HANDLE h, NUL. The length returned is the path without *any* trailing NULs. We also have to handle (or at least not die from) corrupted paths. */ - if (memchr (contents, 0, got) != NULL) - res = strlen (contents); + char *end; + if ((end = (char *) memchr (contents, 0, got)) != NULL) + res = end - contents; else res = got; } -- cgit v1.2.3