diff --git a/src/unix/fs.c b/src/unix/fs.c index bcb8e2c5..a89a10c5 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -350,7 +350,7 @@ static int uv__fs_mkstemp(uv_fs_t* req) { clobber: if (r < 0) - *(path) = '\0'; + path[0] = '\0'; return r; } diff --git a/src/win/fs.c b/src/win/fs.c index ac20a574..c62eccc5 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -1242,6 +1242,7 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) { unsigned int tries, i; size_t len; uint64_t v; + char *path = req->path; len = wcslen(req->file.pathw); ep = req->file.pathw + len; @@ -1265,8 +1266,8 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) { if (func(req)) { if (req->result >= 0) { - len = strlen(req->path); - wcstombs((char*) req->path + len - num_x, ep - num_x, num_x); + len = strlen(path); + wcstombs(path + len - num_x, ep - num_x, num_x); } return; } @@ -1275,7 +1276,7 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) { SET_REQ_RESULT(req, -1); clobber: - (char) *(req->path) = '\0'; + path[0] = '\0'; }