Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
windows: don't strip the trailing slash from filename if it follows a…
Browse files Browse the repository at this point in the history
… device name
  • Loading branch information
Igor Zinkovsky committed Sep 28, 2011
1 parent 4fb120f commit c9ae7a6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/win/fs.c
Expand Up @@ -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) \
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion test/test-fs.c
Expand Up @@ -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.
Expand Down

0 comments on commit c9ae7a6

Please sign in to comment.