[PATCH v1 2/3] xentrace: remove return value from monitor_tbufs

Olaf Hering posted 3 patches 1 year, 3 months ago
There is a newer version of this series
[PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
Posted by Olaf Hering 1 year, 3 months ago
The function always returns zero.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
---
 tools/xentrace/xentrace.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/tools/xentrace/xentrace.c b/tools/xentrace/xentrace.c
index b81abe8a51..a073cab26d 100644
--- a/tools/xentrace/xentrace.c
+++ b/tools/xentrace/xentrace.c
@@ -668,7 +668,7 @@ static void wait_for_event_or_timeout(unsigned long milliseconds)
  * monitor_tbufs - monitor the contents of tbufs and output to a file
  * @logfile:       the FILE * representing the file to log to
  */
-static int monitor_tbufs(void)
+static void monitor_tbufs(void)
 {
     int i;
 
@@ -795,8 +795,6 @@ static int monitor_tbufs(void)
     free(data);
     /* don't need to munmap - cleanup is automatic */
     close(outfd);
-
-    return 0;
 }
 
 
@@ -1164,7 +1162,6 @@ static void parse_args(int argc, char **argv)
 
 int main(int argc, char **argv)
 {
-    int ret;
     struct sigaction act;
 
     opts.outfile = 0;
@@ -1226,9 +1223,9 @@ int main(int argc, char **argv)
     sigaction(SIGINT,  &act, NULL);
     sigaction(SIGALRM, &act, NULL);
 
-    ret = monitor_tbufs();
+    monitor_tbufs();
 
-    return ret;
+    return 0;
 }
 
 /*
Re: [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
Posted by George Dunlap 1 year, 3 months ago
On Fri, May 26, 2023 at 8:29 AM Olaf Hering <olaf@aepfle.de> wrote:

> The function always returns zero.
>

I think a better argument (which I propose to replace the content of the
commit message) would be something like this:

---
The program is structured so that fatal errors cause exit() to be called
directly, rather than being passed up the stack; returning a value here may
mislead people into believing otherwise.
---

With that change:

Reviewed-by: George Dunlap <george.dunlap@cloud.com>

If that sounds OK to you I'll modify it on check-in.

 -George
Re: [PATCH v1 2/3] xentrace: remove return value from monitor_tbufs
Posted by Olaf Hering 1 year, 3 months ago
Fri, 26 May 2023 11:11:58 +0100 George Dunlap <george.dunlap@cloud.com>:

> With that change:
> Reviewed-by: George Dunlap <george.dunlap@cloud.com>
> If that sounds OK to you I'll modify it on check-in.

Yes, sounds good. Thank you.


Olaf