summaryrefslogtreecommitdiff
path: root/lib/open.c
diff options
context:
space:
mode:
authorEric Blake <ebb9@byu.net>2009-09-21 17:19:10 -0600
committerEric Blake <ebb9@byu.net>2009-09-22 06:38:25 -0600
commitf34e1ad57eebc72dbaa7aef0181c1a7d0afff1bf (patch)
tree99781f5b8ccadc58b3b3344e2330262c53d225cf /lib/open.c
parent2611a31b30515961a0cff770dda86e208d9d781d (diff)
downloadgnulib-f34e1ad57eebc72dbaa7aef0181c1a7d0afff1bf.tar.gz
open, openat: minor optimization
* 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>
Diffstat (limited to 'lib/open.c')
-rw-r--r--lib/open.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/open.c b/lib/open.c
index 08ecaff44b..7cc25bd07c 100644
--- a/lib/open.c
+++ b/lib/open.c
@@ -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;