OSDN Git Service

* path.cc (check_sysfile): Don't scan string twice.
authorcorinna <corinna>
Tue, 4 May 2004 10:54:06 +0000 (10:54 +0000)
committercorinna <corinna>
Tue, 4 May 2004 10:54:06 +0000 (10:54 +0000)
winsup/cygwin/ChangeLog
winsup/cygwin/path.cc

index 767ceff..0be6648 100644 (file)
@@ -1,3 +1,7 @@
+2004-05-04  Corinna Vinschen  <corinna@vinschen.de>
+
+       * path.cc (check_sysfile): Don't scan string twice.
+
 2004-05-03  Corinna Vinschen  <corinna@vinschen.de>
 
        * dir.cc (writable_directory): Remove.
index 59e454b..0527491 100644 (file)
@@ -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;
        }