]> Savannah Git Hosting - gnulib.git/commitdiff
utime: Fix a test failure on macOS 10.13.
authorBruno Haible <bruno@clisp.org>
Sat, 5 Dec 2020 01:51:06 +0000 (02:51 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 5 Dec 2020 01:51:06 +0000 (02:51 +0100)
* lib/utime.c (utime): Fix mistake in last commit.

lib/utime.c

index f6465a3cf1f1cd85520909d4a684b34573983ed3..6de8adbb375b79923ed5b1d2d4c0fa5e2522b7f9 100644 (file)
@@ -272,7 +272,7 @@ utime (const char *name, const struct utimbuf *ts)
   /* macOS 10.13 mistakenly succeeds when given a symbolic link to a
      non-directory with a trailing slash.  */
   size_t len = strlen (name);
-  if (ISSLASH (name[len - 1]))
+  if (len > 0 && ISSLASH (name[len - 1]))
     {
       struct stat buf;