open, openat: minor optimization
[gnulib.git] / lib / openat.c
index 7e46a26..079039f 100644 (file)
@@ -103,8 +103,9 @@ rpl_openat (int dfd, char const *filename, int flags, ...)
      with ENOTDIR.  */
   if (fd >= 0)
     {
+      /* We know len is positive, since open did not fail with ENOENT.  */
       size_t len = strlen (filename);
-      if (len > 0 && filename[len - 1] == '/')
+      if (filename[len - 1] == '/')
        {
          struct stat statbuf;