From e38f07e9fae685c92366a0492f234c5576abdd63 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Wed, 23 Nov 2011 08:06:33 +0100 Subject: [PATCH] allow printing domains when no procname are present, handle various / patterns Signed-off-by: Mathieu Desnoyers --- formats/ctf/ctf.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 33287524..20f2dae0 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -1146,10 +1146,11 @@ init_domain_name(struct ctf_trace *td) char *start, *end; start = td->path + strlen(td->collection_path); - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ end = strchr(start, '/'); if (!end) - return; + end = start + strlen(start); memcpy(td->domain, start, end - start); td->domain[end - start] = '\0'; } @@ -1164,11 +1165,13 @@ init_proc_name(struct ctf_trace *td) return; memcpy(buf, td->path, PATH_MAX); start = buf + strlen(td->collection_path); - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ start = strchr(start, '/'); /* get begin of domain content */ if (!start) return; - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ /* find last -, skips time */ end = strrchr(start, '-'); if (!end) @@ -1199,11 +1202,13 @@ init_vpid(struct ctf_trace *td) return; memcpy(buf, td->path, PATH_MAX); start = buf + strlen(td->collection_path); - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ start = strchr(start, '/'); /* get begin of domain content */ if (!start) return; - start++; /* skip / */ + while (start[0] == '/') + start++; /* skip / */ /* find last -, skips time */ end = strrchr(start, '-'); if (!end) -- 2.34.1