Add warning for missing /* TSDL header
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 2 Aug 2011 19:03:53 +0000 (15:03 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 2 Aug 2011 19:03:53 +0000 (15:03 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c

index fd05c0ab2301c293db6aa9728e4d69ea0e1d49f2..021abf88891c6c0ff7dc62beedde1444a162f061 100644 (file)
@@ -613,7 +613,17 @@ int ctf_open_trace_metadata_read(struct ctf_trace *td)
                if (ret)
                        goto end_packet_read;
        } else {
+               char buf[sizeof("/* TSDL")];    /* Includes \0 */
+               ssize_t readlen;
+
                td->byte_order = BYTE_ORDER;
+
+               /* Check text-only metadata header */
+               buf[sizeof("/* TSDL") - 1] = '\0';
+               readlen = fread(buf, sizeof("/* TSDL") - 1, 1, fp);
+               if (readlen < 1 || strcmp(buf, "/* TSDL") != 0)
+                       fprintf(stdout, "[warning] Missing \"/* TSDL\" header for text-only metadata.\n");
+               rewind(fp);
        }
 
        scanner = ctf_scanner_alloc(fp);
This page took 0.024478 seconds and 4 git commands to generate.