All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-trace-devel@vger.kernel.org
Cc: Avidan Borisov <avidanborisov@gmail.com>,
	Ross Zwisler <zwisler@google.com>,
	"Steven Rostedt (Google)" <rostedt@goodmis.org>
Subject: [PATCH 2/2] trace-cmd record: Cleanup - be consistent with return status variable
Date: Tue, 17 Oct 2023 19:20:29 -0400	[thread overview]
Message-ID: <20231017233503.2205514-3-rostedt@goodmis.org> (raw)
In-Reply-To: <20231017233503.2205514-1-rostedt@goodmis.org>

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

The variable that checks return status in daemonize_start() is "rc". To be
consistent with the rest of the code, change it to "ret".

Also check for less than zero instead of -1.

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 tracecmd/trace-record.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c
index c943f486291e..022c27ffc294 100644
--- a/tracecmd/trace-record.c
+++ b/tracecmd/trace-record.c
@@ -1655,7 +1655,7 @@ static void daemonize_start(void)
 	int devnull;
 	int status;
 	int pid;
-	int rc;
+	int ret;
 
 	pid = fork();
 	if (pid == -1)
@@ -1719,12 +1719,12 @@ static void daemonize_start(void)
 			die("daemonize: sigaction failed");
 
 		do {
-			rc = waitpid(pid, &status, 0);
-		} while (!child_detached && ((rc == -1) && (errno == EINTR)));
+			ret = waitpid(pid, &status, 0);
+		} while (!child_detached && ((ret < 0) && (errno == EINTR)));
 
 		if (child_detached)
 			exit(0);
-		else if (rc == pid)
+		else if (ret == pid)
 			exit(WIFEXITED(status));
 		else
 			die("daemonize: waitpid failed");
-- 
2.42.0


      parent reply	other threads:[~2023-10-17 23:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-17 23:20 [PATCH 0/2] trace-cmd: Cleanups for --daemonize option Steven Rostedt
2023-10-17 23:20 ` [PATCH 1/2] trace-cmd record: Use SIGTERM as well for --daemonize Steven Rostedt
2023-10-17 23:20 ` Steven Rostedt [this message]

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=20231017233503.2205514-3-rostedt@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=avidanborisov@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=zwisler@google.com \
    /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.