From 6cdafd91ef71b15af66107b37a5db6b5a3dcd319 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 13 Nov 2024 15:41:33 -0800 Subject: [PATCH 28/31] sysprof-live-unwinder: error out on capture failure --- src/sysprof-live-unwinder/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sysprof-live-unwinder/main.c b/src/sysprof-live-unwinder/main.c index e14eaf6c..a1cd53fa 100644 --- a/src/sysprof-live-unwinder/main.c +++ b/src/sysprof-live-unwinder/main.c @@ -708,7 +708,13 @@ Examples:\n\ return EXIT_FAILURE; } - writer = sysprof_capture_writer_new_from_fd (g_steal_fd (&capture_fd), CAPTURE_BUFFER_SIZE); + if (!(writer = sysprof_capture_writer_new_from_fd (g_steal_fd (&capture_fd), CAPTURE_BUFFER_SIZE))) + { + int errsv = errno; + g_printerr ("Failed to create capture writer: %s\n", + g_strerror (errsv)); + return EXIT_FAILURE; + } if (all_perf_fds->len == 0) { -- 2.45.2