Fix: handling of the filename
authorJulien Desfossez <jdesfossez@efficios.com>
Tue, 18 Feb 2014 21:42:04 +0000 (16:42 -0500)
committerJulien Desfossez <jdesfossez@efficios.com>
Tue, 18 Feb 2014 21:42:04 +0000 (16:42 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
src/common.c
src/iostreamtop.c

index c752c74a29b6f28e25c7f99fb4db7ec117f91046..a6c2e4c3cfa17a24d833dce601947e14761969a1 100644 (file)
@@ -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)
index f3fef7b25ea97043dfc8f89949fb3bbf05556811..e0df4ba2292e6f6f3c1b0dceddc16ba496c4f3ef 100644 (file)
@@ -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);
                        }
This page took 0.032742 seconds and 4 git commands to generate.