From ad7ba32b2d28af951447f332284879d98237bbe3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 4 May 2004 10:54:06 +0000 Subject: [PATCH] * path.cc (check_sysfile): Don't scan string twice. --- winsup/cygwin/ChangeLog | 4 ++++ winsup/cygwin/path.cc | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 767ceff06..0be6648fb 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,7 @@ +2004-05-04 Corinna Vinschen + + * path.cc (check_sysfile): Don't scan string twice. + 2004-05-03 Corinna Vinschen * dir.cc (writable_directory): Remove. 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; }