From: Mathieu Desnoyers Date: Mon, 28 Nov 2011 21:47:46 +0000 (-0500) Subject: Use realpath for path X-Git-Tag: v0.8~6 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=48c3d8f9bd8109bfeb7b5ed0c86f0692dbef1be7;hp=98b6832656447ab0f8024f9086aa67625e391ac7 Use realpath for path Signed-off-by: Mathieu Desnoyers --- 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);