[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2] linux-user: fix is_proc_myself to check the
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] [PATCH v2] linux-user: fix is_proc_myself to check the paths via realpath |
Date: |
Tue, 14 Nov 2017 20:44:58 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
Le 11/11/2017 à 02:48, Zach Riggle a écrit :
> I wrote up a quick example to show that this should work specifically for
> /proc/self/exe:
>
> #define _GNU_SOURCE
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <fcntl.h>
> #include <unistd.h>
> int main(int argc, char** argv) {
> int fd = open("/proc/self/exe", O_NOFOLLOW | O_PATH);
> system("ls -la /proc/$PPID/fd/");
> }
>
And what about a readlink() in a loop until we cross "/proc/<pid>" (or not)?
Thanks,
Laurent