Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

windows: don't strip the trailing slash from filename if it follows a…

… device name
  • Loading branch information...
Igor Zinkovsky
Igor Zinkovsky committed Sep 28, 2011
1 parent 4fb120f commit c9ae7a6f9580eb4f2fe8a73ecdb9b543a10e2673
Showing with 6 additions and 6 deletions.
  1. +5 −5 src/win/fs.c
  2. +1 −1 test/test-fs.c
@@ -77,7 +77,7 @@
if (req->flags & UV_FS_LAST_ERROR_SET) { \
uv__set_sys_error(req->loop, req->last_error); \
} else if (req->result == -1) { \
uv__set_error(req->loop, req->errorno, req->last_error); \
uv__set_error(req->loop, (uv_err_code)req->errorno, req->last_error); \
}

#define SET_REQ_LAST_ERROR(req, error) \
@@ -1022,9 +1022,9 @@ int uv_fs_fchown(uv_loop_t* loop, uv_fs_t* req, uv_file file, int uid,
int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
int len = strlen(path);
char* path2 = NULL;
int has_backslash = (path[len - 1] == '\\' || path[len - 1] == '/');

if (path[len - 1] == '\\' || path[len - 1] == '/') {
if (len > 1 && path[len - 2] != ':' &&
(path[len - 1] == '\\' || path[len - 1] == '/')) {
path2 = strdup(path);
if (!path2) {
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
@@ -1060,9 +1060,9 @@ int uv_fs_stat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb) {
int len = strlen(path);
char* path2 = NULL;
int has_backslash = (path[len - 1] == '\\' || path[len - 1] == '/');

if (path[len - 1] == '\\' || path[len - 1] == '/') {
if (len > 1 && path[len - 2] != ':' &&
(path[len - 1] == '\\' || path[len - 1] == '/')) {
path2 = strdup(path);
if (!path2) {
uv_fatal_error(ERROR_OUTOFMEMORY, "malloc");
@@ -1077,7 +1077,7 @@ TEST_IMPL(fs_symlink) {
r = uv_fs_symlink(loop, &req, "test_file", "test_file_symlink", 0, NULL);
#ifdef _WIN32
if (r == -1) {
if (req.errorno == ENOSYS) {
if (uv_last_error(loop).code == UV_ENOTSUP) {
/*
* Windows doesn't support symlinks on older versions.
* We just pass the test and bail out early if we get ENOTSUP.

0 comments on commit c9ae7a6

Please sign in to comment.
You can’t perform that action at this time.