On Thu, Dec 15, 2022 at 12:21:41PM +0800, Yang Xu wrote: > For some filesystem that doesn't support O_TMPFILE, it will pass > ENOTSUP errno to upper layer. so it will report the following error: > QA output created by 696 > vfstest.c: 1818: setgid_create_umask - Success - failure: is_setgid > vfstest.c: 2421: run_test - Operation not supported - failure... > > To fix this, just reset errno before return. > > Signed-off-by: Yang Xu <xuyang2018.jy@xxxxxxxxxxx> > --- I never hit this failure before, but this change make sense to me. Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx> > src/vfs/utils.c | 6 ++++-- > 1 file changed, 4 insertions(+), 2 deletions(-) > > diff --git a/src/vfs/utils.c b/src/vfs/utils.c > index 6db7a11d..8b000506 100644 > --- a/src/vfs/utils.c > +++ b/src/vfs/utils.c > @@ -921,10 +921,12 @@ bool openat_tmpfile_supported(int dirfd) > > fd = openat(dirfd, ".", O_TMPFILE | O_RDWR, S_IXGRP | S_ISGID); > if (fd == -1) { > - if (errno == ENOTSUP) > + if (errno == ENOTSUP) { > + errno = 0; /* Don't report misleading errno. */ > return false; > - else > + } else { > return log_errno(false, "failure: create"); > + } > } > > if (close(fd)) > -- > 2.27.0 >