From: Alyssa Ross <hi@alyssa.is>
To: leahutils@inbox.vuxu.org
Cc: Alyssa Ross <hi@alyssa.is>
Subject: [PATCH] extrace: skip parent lookup for pid 1
Date: Tue, 15 Jun 2021 12:08:01 +0000 [thread overview]
Message-ID: <20210615120801.121874-1-hi@alyssa.is> (raw)
I was getting a lot of errors that looked like
extrace: process vanished before we found its parent: pid 1: redirfd
Which are easily avoidable.
---
| 3 +++
1 file changed, 3 insertions(+)
--git a/extrace.c b/extrace.c
index e3a441a..4848a6f 100644
--- a/extrace.c
+++ b/extrace.c
@@ -140,6 +140,9 @@ pid_depth(pid_t pid)
char *s;
int fd, d, i;
+ if (pid == 1)
+ return 0;
+
snprintf(name, sizeof name, "/proc/%d/stat", pid);
if ((fd = open(name, O_RDONLY)) < 0)
--
2.31.1
reply other threads:[~2021-06-15 12:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210615120801.121874-1-hi@alyssa.is \
--to=hi@alyssa.is \
--cc=leahutils@inbox.vuxu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).