summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYang Xu <xuyang2018.jy@fujitsu.com>2022-12-15 12:21:41 +0800
committerZorro Lang <zlang@kernel.org>2022-12-17 03:14:54 +0800
commit9c69817e88ef1155cf0cb03a5ec6c5d1ca292356 (patch)
tree692200f9d094c56b656494282cbb99e0897d42a1 /src
parent99b97064065250e12b03ec5d8fd540ceec06ac27 (diff)
src/vfs/utils: Reset errno to zero when detect O_TMPFILE
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@fujitsu.com> Reviewed-by: Zorro Lang <zlang@redhat.com> Signed-off-by: Zorro Lang <zlang@kernel.org>
Diffstat (limited to 'src')
-rw-r--r--src/vfs/utils.c6
1 files 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))