Permalink
Browse files

small fixes for libuv

  • Loading branch information...
zhuomingliang committed Aug 11, 2013
1 parent f1c5bfb commit f7b171cedb4cdbd66c30219687a2dfce6c97308f
Showing with 12 additions and 12 deletions.
  1. +6 −6 3rdparty/libuv/src/unix/fs.c
  2. +6 −6 3rdparty/libuv/src/win/fs.c
@@ -195,7 +195,7 @@ static int uv__fs_mkdir_p(char *pathname, mode_t mode) {
ssize_t r;
size_t len = strlen(pathname);
while ((len > 0) && (pathname[len - 1] == '/'))
while ((len > 0) && (pathname[len - 1] == L'/'))
len--;
pathname[len] = '\0';
@@ -205,21 +205,21 @@ static int uv__fs_mkdir_p(char *pathname, mode_t mode) {
if (r == -1 && errno == ENOENT) {
size_t _len = len;
while ((_len > 0) && (pathname[_len - 1]) == '/')
while ((_len > 0) && (pathname[_len - 1]) == L'/')
_len--;
pathname[_len] = '\0';
pathname[_len] = L'\0';
r = uv__fs_mkdir_p(pathname, mode);
pathname[_len] = '/';
pathname[_len] = L'/';
if(r == 0) {
r = mkdir(pathname, mode);
}
}
pathname[len] = '/';
pathname[len] = L'/';
return r;
}
@@ -618,7 +618,7 @@ static size_t uv__fs_getfullpath(uv_fs_t* req) {
const char *path = req->path;
if (*path == '/') {
if (*path == L'/') {
req->new_path = strdup(path);
} else {
uv_cwd(buf, PATH_MAX);
@@ -817,31 +817,31 @@ static int fs___mkdir_p(wchar_t *pathname) {
size_t r;
size_t len = wcslen(pathname);
while ((len > 0) && (IS_SLASH(pathname[len - 1])))
while (len > 0 && IS_SLASH(pathname[len - 1]))
len--;
pathname[len] = '\0';
pathname[len] = L'\0';
r = _wmkdir(pathname);
if (r == -1 && errno == ENOENT) {
size_t _len = len;
while ((_len > 0) && (IS_SLASH(pathname[_len - 1])))
while (_len > 0 && IS_SLASH(pathname[_len - 1]))
_len--;
pathname[_len] = '\0';
pathname[_len] = L'\0';
r = fs___mkdir_p(pathname);
pathname[_len] = '/';
pathname[_len] = L'/';
if(r == 0) {
r = _wmkdir(pathname);
}
}
pathname[len] = '/';
pathname[len] = L'/';
return r;
}

0 comments on commit f7b171c

Please sign in to comment.