]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
libext2fs: use F_GETFL, not F_GETFD, in unixfd_open
authorDarrick J. Wong <djwong@kernel.org>
Thu, 28 Aug 2025 17:30:38 +0000 (10:30 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Fri, 17 Oct 2025 23:34:21 +0000 (16:34 -0700)
F_GETFD is the fcntl command that returns FD_* flags, but the callsite
wants to look at the O_* flags.  F_GETFL is the fcntl command that
returns the O_* flags, so change the subcommand to be correct.

Cc: <linux-ext4@vger.kernel.org> # v1.43.2
Fixes: 4ccf9e4fe165cf ("libext2fs: add unixfd_io_manager")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
lib/ext2fs/unix_io.c

index cb408f51779aa7a3c2f382cb2da923ff353605e2..adbdd5f6603d74c578bb1a7e45a814acb662ff63 100644 (file)
@@ -1086,7 +1086,7 @@ static errcode_t unixfd_open(const char *str_fd, int flags,
 
        fd = atoi(str_fd);
 #if defined(HAVE_FCNTL)
-       fd_flags = fcntl(fd, F_GETFD);
+       fd_flags = fcntl(fd, F_GETFL);
        if (fd_flags == -1)
                return EBADF;