Use realpath for path
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 28 Nov 2011 21:47:46 +0000 (16:47 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 28 Nov 2011 21:47:46 +0000 (16:47 -0500)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
formats/ctf/ctf.c

index 7839bb33574f3d0f4a5ac8a3c9dd0c4ec9711a99..0f216933b6c06c215e8fba048c23f03e7c24fd22 100644 (file)
@@ -1239,7 +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;
+       char *respath, *rescolpath;
 
        td->flags = flags;
 
@@ -1258,13 +1258,16 @@ int ctf_open_trace_read(struct ctf_trace *td, const char *collection_path,
                ret = -errno;
                goto error_dirfd;
        }
-       respath = realpath(collection_path, td->collection_path);
-       if (!respath) {
+       rescolpath = realpath(collection_path, td->collection_path);
+       if (!rescolpath) {
+               fprintf(stdout, "[error] collection path resolution failure\n");
+               return -EINVAL;
+       }
+       respath = realpath(path, td->path);
+       if (!rescolpath) {
                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);
        init_proc_name(td);
        init_vpid(td);
This page took 0.025964 seconds and 4 git commands to generate.