From f614b43a69693022119807709a62d361b7c5517d Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 9 Jul 2016 10:02:06 +0200 Subject: [PATCH] win: simplify memory copy logic in fs.c MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hopefully shuts up a -Wmaybe-uninitialized warning about the path_len variable. Fixes: https://github.com/libuv/libuv/issues/941 PR-URL: https://github.com/libuv/libuv/pull/942 Reviewed-By: Saúl Ibarra Corretgé --- src/win/fs.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/win/fs.c b/src/win/fs.c index 24c608475eb..b6d43921529 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -204,14 +204,11 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path, req->fs.info.new_pathw = NULL; } - if (!copy_path) { - req->path = path; - } else if (path) { + req->path = path; + if (path != NULL && copy_path) { memcpy(pos, path, path_len); assert(path_len == buf_sz - (pos - buf)); req->path = pos; - } else { - req->path = NULL; } req->flags |= UV_FS_FREE_PATHS;