| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1054,7 +1054,7 @@ static void InternalModuleStat(const FunctionCallbackInfo<Value>& args) { | |||
| 1054 | 1054 | int rc = uv_fs_stat(env->event_loop(), &req, *path, nullptr); | |
| 1055 | 1055 | if (rc == 0) { | |
| 1056 | 1056 | const uv_stat_t* const s = static_cast<const uv_stat_t*>(req.ptr); | |
| 1057 | - rc = !!(s->st_mode & S_IFDIR); | ||
| 1057 | + rc = S_ISDIR(s->st_mode); | ||
| 1058 | 1058 | } | |
| 1059 | 1059 | uv_fs_req_cleanup(&req); | |
| 1060 | 1060 | ||
@@ -2982,7 +2982,7 @@ BindingData::FilePathIsFileReturnType BindingData::FilePathIsFile( | |||
| 2982 | 2982 | ||
| 2983 | 2983 | if (rc == 0) { | |
| 2984 | 2984 | const uv_stat_t* const s = static_cast<const uv_stat_t*>(req.ptr); | |
| 2985 | - rc = !!(s->st_mode & S_IFDIR); | ||
| 2985 | + rc = S_ISDIR(s->st_mode); | ||
| 2986 | 2986 | } | |
| 2987 | 2987 | ||
| 2988 | 2988 | uv_fs_req_cleanup(&req); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ std::string WildcardIfDir(const std::string& res) noexcept { | |||
| 21 | 21 | int rc = uv_fs_stat(nullptr, &req, res.c_str(), nullptr); | |
| 22 | 22 | if (rc == 0) { | |
| 23 | 23 | const uv_stat_t* const s = static_cast<const uv_stat_t*>(req.ptr); | |
| 24 | - if (s->st_mode & S_IFDIR) { | ||
| 24 | + if ((s->st_mode & S_IFMT) == S_IFDIR) { | ||
| 25 | 25 | // add wildcard when directory | |
| 26 | 26 | if (res.back() == node::kPathSeparator) { | |
| 27 | 27 | return res + "*"; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,14 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const fs = require('fs'); | ||
| 4 | + const net = require('net'); | ||
| 5 | + | ||
| 6 | + const tmpdir = require('../common/tmpdir'); | ||
| 7 | + tmpdir.refresh(); | ||
| 8 | + | ||
| 9 | + const server = net.createServer().listen(common.PIPE, common.mustCall(() => { | ||
| 10 | + // The process should not crash | ||
| 11 | + // See https://github.com/nodejs/node/issues/52159 | ||
| 12 | + fs.readdirSync(tmpdir.path, { recursive: true }); | ||
| 13 | + server.close(); | ||
| 14 | + })); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments