readlink() failures are normal. pseudo should just set errno and let the
program decide whether to report it. E.g. /proc/$pid/{cwd,exe,fd/*,root} are
unreadable for other users' processes. The "pidof" program calls stat() on
each /proc/$pid/exe, which causes pseudo to spam stderr. "pidof" is used e.g.
by various dpkg postinst scripts.

This if branch also forgot to update *pcurrent, so "cat /proc/1/cwd/stat"
would read /proc/1/stat instead of failing as it should.

Signed-off-by: Tomi Belan <tomi.be...@gmail.com>
---
Hi. I'd like to contribute this patch to 'pseudo'. I'm not familiar with
git-send-email so I hope I sent it to the right place and it looks good.
Cheers!

 pseudo_util.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pseudo_util.c b/pseudo_util.c
index f150a1b..e8e9803 100644
--- a/pseudo_util.c
+++ b/pseudo_util.c
@@ -679,7 +679,7 @@ pseudo_append_element(char *newpath, char *root, size_t 
allocated, char **pcurre
        if (!leave_this && is_dir) {
                int is_link = S_ISLNK(buf->st_mode);
                if (link_recursion >= PSEUDO_MAX_LINK_RECURSION && is_link) {
-                       pseudo_diag("link recursion too deep, not expanding 
path '%s'.\n", newpath);
+                       pseudo_debug(PDBGF_PATH, "link recursion too deep, not 
expanding path '%s'.\n", newpath);
                        is_link = 0;
                }
                if (is_link) {
@@ -689,7 +689,8 @@ pseudo_append_element(char *newpath, char *root, size_t 
allocated, char **pcurre
 
                        linklen = readlink(newpath, linkbuf, pseudo_path_max());
                        if (linklen == -1) {
-                               pseudo_diag("uh-oh!  '%s' seems to be a 
symlink, but I can't read it.  Ignoring.", newpath);
+                               pseudo_debug(PDBGF_PATH, "uh-oh!  '%s' seems to 
be a symlink, but I can't read it.  Ignoring.\n", newpath);
+                               *pcurrent = current;
                                return 0;
                        }
                        /* null-terminate buffer */
-- 
2.25.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#169637): 
https://lists.openembedded.org/g/openembedded-core/message/169637
Mute This Topic: https://lists.openembedded.org/mt/93126613/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to