diff options
author | Eric Blake <ebb9@byu.net> | 2009-09-21 17:19:10 -0600 |
---|---|---|
committer | Eric Blake <ebb9@byu.net> | 2009-09-22 06:38:25 -0600 |
commit | f34e1ad57eebc72dbaa7aef0181c1a7d0afff1bf (patch) | |
tree | 99781f5b8ccadc58b3b3344e2330262c53d225cf /lib/openat.c | |
parent | 2611a31b30515961a0cff770dda86e208d9d781d (diff) | |
download | gnulib-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/openat.c')
-rw-r--r-- | lib/openat.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/openat.c b/lib/openat.c index 7e46a2672b..079039fee3 100644 --- a/lib/openat.c +++ b/lib/openat.c @@ -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; |