Skip to content

Commit 7329538

Browse files
committed
Few Changes
* Avoid copying unnecessary files on NPM install * Fix type in `Realloc` * Fix inconsistency of `GetTime` usage * Avoid undefined behavior when loading invalid INode from dump
1 parent 9a0aec0 commit 7329538

3 files changed

Lines changed: 7 additions & 12 deletions

File tree

FileSystem.cc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace {
8080
if (!Alloc(&newPtr, sizeof(T) * length))
8181
return length < ptrLen;
8282
if (*ptr) {
83-
memcpy(newPtr, *ptr, sizeof(T) * Min<uint64_t>(ptrLen, length));
83+
memcpy(newPtr, *ptr, sizeof(T) * Min<size_t>(ptrLen, length));
8484
Delete(*ptr);
8585
}
8686
*ptr = newPtr;
@@ -203,8 +203,9 @@ namespace {
203203

204204
struct BaseINode {
205205
BaseINode() {
206-
GetTime(&btime);
207-
ctime = mtime = atime = btime;
206+
struct fs_timespec ts;
207+
GetTime(&ts);
208+
ctime = mtime = atime = btime = ts;
208209
}
209210
fs_ino_t ndx;
210211
fs_ino_t id;
@@ -1035,11 +1036,7 @@ namespace {
10351036
return Alloc((struct DirectoryINode**)inode);
10361037
if (FS_S_ISLNK(mode))
10371038
return Alloc((struct SymLinkINode**)inode);
1038-
#ifdef __linux__
1039-
__builtin_unreachable();
1040-
#else
1041-
__assume(0);
1042-
#endif
1039+
return false;
10431040
}
10441041
}
10451042

binding.gyp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
'copies': [{
1010
'destination': '<(module_root_dir)/build/Release/',
1111
'files': [
12-
'<(module_root_dir)/FileSystem.dll',
13-
'<(module_root_dir)/FileSystem.lib',
14-
'<(module_root_dir)/FileSystem.pdb'
12+
'<(module_root_dir)/FileSystem.dll'
1513
]
1614
}]
1715
}, {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@daisydogs07/filesystem",
3-
"version": "5.2.10",
3+
"version": "5.2.11",
44
"os": ["linux", "win32"],
55
"cpu": ["x64"],
66
"keywords": [

0 commit comments

Comments
 (0)