Skip to content

Commit e13350c

Browse files
committed
Added node patch for fs.readFile[Sync]() problem with reading /dev/stdin
SmartOS issue: TritonDataCenter/smartos-live#753 Node.js issue: nodejs/node#1074 and nodejs/node-v0.x-archive#7412 Patch from: nodejs/node-v0.x-archive@a6af709
1 parent b90ebff commit e13350c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff -Naur node-v0.10.26.old/lib/fs.js node-v0.10.26/lib/fs.js
2+
--- node-v0.10.26.old/lib/fs.js 2014-02-19 00:34:29.000000000 +0100
3+
+++ node-v0.10.26/lib/fs.js 2017-12-16 00:54:39.000000000 +0100
4+
@@ -209,7 +209,7 @@
5+
6+
fs.fstat(fd, function(er, st) {
7+
if (er) return callback(er);
8+
- size = st.size;
9+
+ size = st.isFile() ? st.size : 0;
10+
if (size === 0) {
11+
// the kernel lies about many files.
12+
// Go ahead and try to read some bytes.
13+
@@ -283,10 +283,12 @@
14+
var flag = options.flag || 'r';
15+
var fd = fs.openSync(path, flag, 438 /*=0666*/);
16+
17+
+ var st;
18+
var size;
19+
var threw = true;
20+
try {
21+
- size = fs.fstatSync(fd).size;
22+
+ st = fs.fstatSync(fd);
23+
+ size = st.isFile() ? st.size : 0;
24+
threw = false;
25+
} finally {
26+
if (threw) fs.closeSync(fd);

0 commit comments

Comments
 (0)