From: Julien Desfossez Date: Tue, 18 Feb 2014 21:42:04 +0000 (-0500) Subject: Fix: handling of the filename X-Git-Tag: v0.3~27 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=18e85696d986196569d5c67ce5352708948f88df;p=lttngtop.git Fix: handling of the filename Signed-off-by: Julien Desfossez --- diff --git a/src/common.c b/src/common.c index c752c74..a6c2e4c 100644 --- a/src/common.c +++ b/src/common.c @@ -298,7 +298,7 @@ struct processtop *get_proc_pid(struct lttngtop *ctx, int tid, int pid, tmp = find_process_tid(ctx, tid, NULL); if (tmp && tmp->pid == pid) return tmp; - return add_proc(ctx, tid, "Unknown", timestamp, hostname); + return add_proc(ctx, tid, NULL, timestamp, hostname); } void add_thread(struct processtop *parent, struct processtop *thread) @@ -502,7 +502,10 @@ struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end) if (tmpfile != NULL) { memcpy(newfile, tmpfile, sizeof(struct files)); - newfile->name = strdup(tmpfile->name); + if (tmpfile->name) + newfile->name = strdup(tmpfile->name); + else + newfile->name = NULL; newfile->ref = new; g_ptr_array_add(new->process_files_table, newfile); @@ -590,7 +593,7 @@ enum bt_cb_ret handle_statedump_process_state(struct bt_ctf_event *call_data, struct processtop *proc; unsigned long timestamp; int64_t pid, tid, ppid, vtid, vpid, vppid; - char *procname, *hostname = NULL; + char *procname = NULL, *hostname = NULL; timestamp = bt_ctf_get_timestamp(call_data); if (timestamp == -1ULL) diff --git a/src/iostreamtop.c b/src/iostreamtop.c index f3fef7b..e0df4ba 100644 --- a/src/iostreamtop.c +++ b/src/iostreamtop.c @@ -103,7 +103,7 @@ void insert_file(struct processtop *proc, int fd) return; if (fd >= proc->process_files_table->len) { tmp = g_new0(struct files, 1); - tmp->name = "Unknown"; + tmp->name = NULL; tmp->read = 0; tmp->write = 0; tmp->fd = fd; @@ -113,7 +113,7 @@ void insert_file(struct processtop *proc, int fd) tmp = g_ptr_array_index(proc->process_files_table, fd); if (tmp == NULL) { tmp = g_new0(struct files, 1); - tmp->name = "Unknown"; + tmp->name = NULL; tmp->read = 0; tmp->write = 0; tmp->fd = fd; @@ -124,7 +124,7 @@ void insert_file(struct processtop *proc, int fd) if (parent) { tmp_parent = g_ptr_array_index( parent->process_files_table, fd); - if (tmp_parent && + if (tmp_parent && tmp->name && (strcmp(tmp->name, tmp_parent->name)) != 0) tmp->name = strdup(tmp_parent->name); }