summaryrefslogtreecommitdiff
path: root/tests/same-inode.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2025-10-18 19:06:52 +0200
committerJörg Frings-Fürst <debian@jff.email>2025-10-18 19:06:52 +0200
commit27dae84ed92f1ef0300263091972338d12e78348 (patch)
tree7c52931f474fafb8a4bd4fd15ca3461c77cdecc2 /tests/same-inode.h
parent4682deeb62247d34de87f8e777f99e2d337fd377 (diff)
New upstream version 1.4.1upstream/1.4.1upstream
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..70f17b03 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-2025 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));
}