open, openat: minor optimization
[gnulib.git] / lib / open.c
index 08ecaff..7cc25bd 100644 (file)
@@ -141,8 +141,9 @@ open (const char *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;