development list for leahutils (lr, xe, snooze, ...)
 help / color / mirror / Atom feed
* [PATCH] extrace: skip parent lookup for pid 1
@ 2021-06-15 12:08 Alyssa Ross
  0 siblings, 0 replies; only message in thread
From: Alyssa Ross @ 2021-06-15 12:08 UTC (permalink / raw)
  To: leahutils; +Cc: Alyssa Ross

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.
---
 extrace.c | 3 +++
 1 file changed, 3 insertions(+)

diff --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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-15 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15 12:08 [PATCH] extrace: skip parent lookup for pid 1 Alyssa Ross

development list for leahutils (lr, xe, snooze, ...)

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/leahutils

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 leahutils leahutils/ https://inbox.vuxu.org/leahutils \
		leahutils@inbox.vuxu.org
	public-inbox-index leahutils

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.devel.leahutils


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git