diff mbox series

[2/2] trace-cmd record: Cleanup - be consistent with return status variable

Message ID 20231017233503.2205514-3-rostedt@goodmis.org (mailing list archive)
State Accepted
Commit f0743ab4b8622d82d8a2585a46f782a58d59f5bf
Headers show
Series trace-cmd: Cleanups for --daemonize option | expand

Commit Message

Steven Rostedt Oct. 17, 2023, 11:20 p.m. UTC
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 mbox series

Patch

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");