* lib/open.c (open): If open succeeded, len is non-zero.
* lib/openat.c (rpl_openat): Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
2009-09-22 Eric Blake <ebb9@byu.net>
+ open, openat: minor optimization
+ * lib/open.c (open): If open succeeded, len is non-zero.
+ * lib/openat.c (rpl_openat): Likewise.
+
link-follow: ensure correct result
* m4/fcntl_h.m4 (gl_FCNTL_H): Clean up temporary file.
* m4/link-follow.m4 (gl_FUNC_LINK_FOLLOWS_SYMLINK): Likewise, and
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;
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;