diff --git a/src/generated_struct_info32.json b/src/generated_struct_info32.json index be4941e6d86a..dceaadbed8d7 100644 --- a/src/generated_struct_info32.json +++ b/src/generated_struct_info32.json @@ -383,7 +383,10 @@ "S_IFMT": 61440, "S_IFREG": 32768, "S_IFSOCK": 49152, + "S_IRGRP": 32, + "S_IROTH": 4, "S_IRUGO": 292, + "S_IRUSR": 256, "S_IRWXO": 7, "S_IRWXUGO": 511, "S_ISVTX": 512, diff --git a/src/generated_struct_info64.json b/src/generated_struct_info64.json index 1bcabe48a880..ef23e32b4a9e 100644 --- a/src/generated_struct_info64.json +++ b/src/generated_struct_info64.json @@ -383,7 +383,10 @@ "S_IFMT": 61440, "S_IFREG": 32768, "S_IFSOCK": 49152, + "S_IRGRP": 32, + "S_IROTH": 4, "S_IRUGO": 292, + "S_IRUSR": 256, "S_IRWXO": 7, "S_IRWXUGO": 511, "S_ISVTX": 512, diff --git a/src/library_nodefs.js b/src/library_nodefs.js index 7f5b990a88a9..0a09881e182c 100644 --- a/src/library_nodefs.js +++ b/src/library_nodefs.js @@ -71,7 +71,7 @@ addToLibrary({ if (NODEFS.isWindows) { // Node.js on Windows never represents permission bit 'x', so // propagate read bits to execute bits - stat.mode = stat.mode | ((stat.mode & 292) >> 2); + stat.mode |= (stat.mode & {{{ cDefs.S_IRUSR | cDefs.S_IRGRP | cDefs.S_IROTH }}}) >> 2; } } catch (e) { if (!e.code) throw e; diff --git a/src/library_wasmfs_node.js b/src/library_wasmfs_node.js index a23b4b3e2273..2c2cde7d9e09 100644 --- a/src/library_wasmfs_node.js +++ b/src/library_wasmfs_node.js @@ -21,7 +21,7 @@ addToLibrary({ if (wasmfsNodeIsWindows) { // Node.js on Windows never represents permission bit 'x', so // propagate read bits to execute bits - stat.mode = stat.mode | ((stat.mode & 292) >> 2); + stat.mode |= (stat.mode & {{{ cDefs.S_IRUSR | cDefs.S_IRGRP | cDefs.S_IROTH }}}) >> 2; } return stat; }, diff --git a/src/struct_info.json b/src/struct_info.json index 433105ff1ebc..32e18a0fab00 100644 --- a/src/struct_info.json +++ b/src/struct_info.json @@ -30,7 +30,10 @@ "S_IFSOCK", "S_IFBLK", "S_IFLNK", - "S_IFCHR" + "S_IFCHR", + "S_IRUSR", + "S_IRGRP", + "S_IROTH" ], "structs": { "stat": [