This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:
Subject: v4l2-tracer: use stat to verify that retrace file exists Author: Deborah Brouwer <deborah.brou...@collabora.com> Date: Thu Nov 30 16:46:34 2023 -0800 Instead of opening and closing the file to see if it exists, just use stat. This avoids cluttering a trace with extra opens/closes. Also change the return value to give a better description of the failure to the calling function. Signed-off-by: Deborah Brouwer <deborah.brou...@collabora.com> Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl> utils/v4l2-tracer/retrace.cpp | 7 +++---- utils/v4l2-tracer/v4l2-tracer-common.h | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) --- http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=def037b790d87221e57536cd8e8b40eda125428e diff --git a/utils/v4l2-tracer/retrace.cpp b/utils/v4l2-tracer/retrace.cpp index b8a1c8fb285c..60d64d8b1e22 100644 --- a/utils/v4l2-tracer/retrace.cpp +++ b/utils/v4l2-tracer/retrace.cpp @@ -1537,12 +1537,11 @@ void retrace_array(json_object *root_array_obj) int retrace(std::string trace_filename) { - FILE *trace_file = fopen(trace_filename.c_str(), "r"); - if (trace_file == nullptr) { + struct stat sb; + if (stat(trace_filename.c_str(), &sb) == -1) { line_info("\n\tTrace file error: \'%s\'", trace_filename.c_str()); - return 1; + return -EINVAL; } - fclose(trace_file); fprintf(stderr, "Retracing: %s\n", trace_filename.c_str()); diff --git a/utils/v4l2-tracer/v4l2-tracer-common.h b/utils/v4l2-tracer/v4l2-tracer-common.h index c8b5dbd4b873..adb412183cfd 100644 --- a/utils/v4l2-tracer/v4l2-tracer-common.h +++ b/utils/v4l2-tracer/v4l2-tracer-common.h @@ -26,6 +26,7 @@ #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/types.h> +#include <sys/stat.h> #include <unistd.h> #include <unordered_map> #include <vector> _______________________________________________ linuxtv-commits mailing list linuxtv-commits@linuxtv.org https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits