summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMateusz Guzik <mjg@FreeBSD.org>2020-01-17 14:40:09 +0000
committerMateusz Guzik <mjg@FreeBSD.org>2020-01-17 14:40:09 +0000
commit360af171b3dde5cd316fc76068c0d31972bef1d6 (patch)
tree71a2113bdc33ea7978eaf06cc0739a986c70c890
parent1ad72b270caf29a0538f51df1b6e405c3be965e9 (diff)
Notes
-rw-r--r--lib/libc/gen/opendir.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 98354e028dc40..a6e7859288a0a 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -283,7 +283,7 @@ __opendir_common(int fd, int flags, bool use_current_pos)
DIR *dirp;
int incr;
int saved_errno;
- int unionstack;
+ bool unionstack;
if ((dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
return (NULL);
@@ -310,15 +310,14 @@ __opendir_common(int fd, int flags, bool use_current_pos)
/*
* Determine whether this directory is the top of a union stack.
*/
+ unionstack = false;
if (flags & DTF_NODUP) {
struct statfs sfb;
- if (_fstatfs(fd, &sfb) < 0)
- goto fail;
- unionstack = !strcmp(sfb.f_fstypename, "unionfs")
- || (sfb.f_flags & MNT_UNION);
- } else {
- unionstack = 0;
+ if (_fstatfs(fd, &sfb) == 0) {
+ unionstack = strcmp(sfb.f_fstypename, "unionfs") == 0 ||
+ (sfb.f_flags & MNT_UNION);
+ }
}
if (unionstack) {