Date: Fri, 17 Jan 2020 14:40:10 +0000 (UTC) From: Mateusz Guzik <mjg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r356829 - head/lib/libc/gen Message-ID: <202001171440.00HEeAPn061518@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mjg Date: Fri Jan 17 14:40:09 2020 New Revision: 356829 URL: https://svnweb.freebsd.org/changeset/base/356829 Log: libc: assume no union stack if fstatfs fails in readdir The failure is not really expected, but should it happen it's better to get some data. Suggested by: kib Modified: head/lib/libc/gen/opendir.c Modified: head/lib/libc/gen/opendir.c ============================================================================== --- head/lib/libc/gen/opendir.c Fri Jan 17 14:39:00 2020 (r356828) +++ head/lib/libc/gen/opendir.c Fri Jan 17 14:40:09 2020 (r356829) @@ -283,7 +283,7 @@ __opendir_common(int fd, int flags, bool use_current_p 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_p /* * 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) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202001171440.00HEeAPn061518>