X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fctf.c;h=0f216933b6c06c215e8fba048c23f03e7c24fd22;hp=7839bb33574f3d0f4a5ac8a3c9dd0c4ec9711a99;hb=48c3d8f9bd8109bfeb7b5ed0c86f0692dbef1be7;hpb=98b6832656447ab0f8024f9086aa67625e391ac7 diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 7839bb33..0f216933 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -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);