summaryrefslogtreecommitdiff
path: root/tests/same-inode.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
committerJörg Frings-Fürst <debian@jff.email>2026-03-10 13:24:07 +0100
commitcfd1f17f1a85d95ea12bca8dae42add7dad1ad11 (patch)
tree8016486f8ee7157213f2d09ff2491bfa9c94638a /tests/same-inode.h
parent14e4d584d0121031ec40e6c35869745f1747ff29 (diff)
parent1403307d6e2fb4e7b5d97a35f40d1e95134561ab (diff)
Merge branch 'release/debian/1.4.2-1'HEADdebian/1.4.2-1master
Diffstat (limited to 'tests/same-inode.h')
-rw-r--r--tests/same-inode.h11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/same-inode.h b/tests/same-inode.h
index 13ae24b7..025901a2 100644
--- a/tests/same-inode.h
+++ b/tests/same-inode.h
@@ -1,6 +1,6 @@
/* Determine whether two stat buffers are known to refer to the same file.
- Copyright (C) 2006, 2009-2024 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2009-2026 Free Software Foundation, Inc.
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as
@@ -77,12 +77,17 @@ extern "C" {
#define SAME_INODE(a, b) PSAME_INODE (&(a), &(b))
/* True if *A and *B represent the same file. Unlike PSAME_INODE,
- args are evaluated once and must point to struct stat. */
+ args are evaluated once and must point to struct stat,
+ and this function works even on POSIX platforms where fstat etc. do
+ not return useful st_dev and st_ino values for shared memory
+ objects and typed memory objects. */
SAME_INODE_INLINE bool
psame_inode (struct stat const *a, struct stat const *b)
{
- return PSAME_INODE (a, b);
+ return (! (S_TYPEISSHM (a) | S_TYPEISTMO (a)
+ | S_TYPEISSHM (b) | S_TYPEISTMO (b))
+ && PSAME_INODE (a, b));
}