From 0cdb8df6202e1b18d219c7fd0d74dd262231de78 Mon Sep 17 00:00:00 2001 From: Mike Yuan Date: Mon, 11 Mar 2024 16:28:30 +0800 Subject: [PATCH] stat-util: introduce fd_inode_same --- src/basic/stat-util.h | 4 +++- src/shared/ptyfwd.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/basic/stat-util.h b/src/basic/stat-util.h index 47445d852a..c5dfd2db16 100644 --- a/src/basic/stat-util.h +++ b/src/basic/stat-util.h @@ -47,10 +47,12 @@ static inline int null_or_empty_path(const char *fn) { int path_is_read_only_fs(const char *path); int inode_same_at(int fda, const char *filea, int fdb, const char *fileb, int flags); - static inline int inode_same(const char *filea, const char *fileb, int flags) { return inode_same_at(AT_FDCWD, filea, AT_FDCWD, fileb, flags); } +static inline int fd_inode_same(int fda, int fdb) { + return inode_same_at(fda, NULL, fdb, NULL, AT_EMPTY_PATH); +} /* The .f_type field of struct statfs is really weird defined on * different archs. Let's give its type a name. */ diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c index 17c1549132..d572a02ca4 100644 --- a/src/shared/ptyfwd.c +++ b/src/shared/ptyfwd.c @@ -884,7 +884,7 @@ int pty_forward_new( assert(f->input_fd >= 0); - same = inode_same_at(f->input_fd, NULL, f->output_fd, NULL, AT_EMPTY_PATH); + same = fd_inode_same(f->input_fd, f->output_fd); if (same < 0) return same; -- 2.25.1