Skip to content

Commit

Permalink
win: simplify memory copy logic in fs.c
Browse files Browse the repository at this point in the history
Hopefully shuts up a -Wmaybe-uninitialized warning about the path_len
variable.

Fixes: libuv#941
PR-URL: libuv#942
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
  • Loading branch information
bnoordhuis committed Jul 30, 2016
1 parent ef6f3e8 commit f614b43
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/win/fs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f614b43

Please sign in to comment.