[PATCH 2/5] v4l2-tracer: remove trailing comma from JSON trace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Put the trace file into valid JSON format by removing the trailing comma
from the trace file array.

Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>
---
 utils/v4l2-tracer/v4l2-tracer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/utils/v4l2-tracer/v4l2-tracer.cpp b/utils/v4l2-tracer/v4l2-tracer.cpp
index ae6f68e4..7adbe04e 100644
--- a/utils/v4l2-tracer/v4l2-tracer.cpp
+++ b/utils/v4l2-tracer/v4l2-tracer.cpp
@@ -346,7 +346,7 @@ int tracer(int argc, char *argv[], bool retrace)
 
 	/* Close the json-array and the trace file. */
 	trace_file = fopen(trace_filename.c_str(), "a");
-	fseek(trace_file, 0L, SEEK_END);
+	ftruncate(fileno(trace_file), lseek(fileno(trace_file), 0, SEEK_END) - 2);
 	fputs("\n]\n", trace_file);
 	fclose(trace_file);
 
-- 
2.39.0




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux