Use realpath on trace collection path
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 23 Nov 2011 09:49:46 +0000 (10:49 +0100)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 23 Nov 2011 09:49:46 +0000 (10:49 +0100)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c

index 20f2dae0bd6efe28c2ca3b70da43ba0929f9063f..7839bb33574f3d0f4a5ac8a3c9dd0c4ec9711a99 100644 (file)
@@ -1239,6 +1239,7 @@ int ctf_open_trace_read(struct ctf_trace *td, const char *collection_path,
        struct dirent *dirent;
        struct dirent *diriter;
        size_t dirent_len;
+       char *respath;
 
        td->flags = flags;
 
@@ -1257,8 +1258,11 @@ int ctf_open_trace_read(struct ctf_trace *td, const char *collection_path,
                ret = -errno;
                goto error_dirfd;
        }
-       strncpy(td->collection_path, collection_path, PATH_MAX);
-       td->collection_path[PATH_MAX - 1] = '\0';
+       respath = realpath(collection_path, td->collection_path);
+       if (!respath) {
+               fprintf(stdout, "[error] path resolution failure\n");
+               return -EINVAL;
+       }
        strncpy(td->path, path, PATH_MAX);
        td->path[PATH_MAX - 1] = '\0';
        init_domain_name(td);
This page took 0.025316 seconds and 4 git commands to generate.