From: "Mike Crowe" <yocto@mac.mcrowe.com>
To: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [pseudo][PATCH] test-openat: Consider device as well as inode number
Date: Mon, 6 Sep 2021 17:36:27 +0100 [thread overview]
Message-ID: <YTZDi+62lXYaMFnP@mcrowe.com> (raw)
In-Reply-To: <169A4FE272BB166C.28384@lists.openembedded.org>
On Wednesday 11 August 2021 at 18:13:54 +0100, Mike Crowe via lists.openembedded.org wrote:
> It just so happens that my /home/mac and /home directories have the same
> inode number but on different filesystems.
>
> This means that test-openat fails with "Recursion failed!" even when run
> without pseudo.
>
> Let's consider both the device number and the inode number before
> assuming that we've found the same directory again.
>
> Signed-off-by: Mike Crowe <mac@mcrowe.com>
> ---
> test/test-openat.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/test/test-openat.c b/test/test-openat.c
> index b710285..df6655a 100644
> --- a/test/test-openat.c
> +++ b/test/test-openat.c
> @@ -25,11 +25,13 @@ int main () {
> int fd, dir_fd;
> struct stat st;
> ino_t ino;
> + dev_t dev;
> char *path;
>
> fd = openat(AT_FDCWD, ".", O_DIRECTORY, 0);
> fstat(fd, &st);
> ino = st.st_ino;
> + dev = st.st_dev;
>
> while (1) {
> path = path_of(fd);
> @@ -37,7 +39,7 @@ int main () {
>
> dir_fd = openat(fd, "../", O_DIRECTORY, 0);
> fstat(dir_fd, &st);
> - if (st.st_ino == ino) {
> + if (st.st_ino == ino && st.st_dev == dev) {
> if (strcmp(path, "/") == 0) {
> //puts("Reached top of tree");
> return 0;
> @@ -49,6 +51,7 @@ int main () {
>
> free (path);
> ino = st.st_ino;
> + dev = st.st_dev;
> fd = dir_fd;
> }
> return 0;
> --
> 2.30.2
>
Ping!
Mike.
parent reply other threads:[~2021-09-06 16:36 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <169A4FE272BB166C.28384@lists.openembedded.org>]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YTZDi+62lXYaMFnP@mcrowe.com \
--to=yocto@mac.mcrowe.com \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.