Mercurial > hg > rlgwebd
diff rlgwebd.js @ 148:bac9c3b01692
Check that the ttyrec stream has an fd before passing it to fstat.
The stream might not have an fd, presumably if the open isn't complete.
Calling fstat then causes crashes.
author | John "Elwin" Edwards |
---|---|
date | Mon, 06 Jan 2014 09:11:35 -0500 |
parents | 81a8e7aa4687 |
children | 245a2959f504 |
line wrap: on
line diff
--- a/rlgwebd.js Wed Jan 01 14:13:10 2014 -0500 +++ b/rlgwebd.js Mon Jan 06 09:11:35 2014 -0500 @@ -1035,8 +1035,10 @@ } } for (var i = 0; i < statusinfo.g.length; i++) { - if (statusinfo.g[i].n in sessions) { - fs.fstat(sessions[statusinfo.g[i].n].record.fd, makecallback(i)); + /* fd sometimes isn't a number, presumably when the file isn't open yet. */ + var ssid = statusinfo.g[i].n; + if (ssid in sessions && typeof(sessions[ssid].record.fd) == 'number') { + fs.fstat(sessions[ssid].record.fd, makecallback(i)); } else { idleset(i, null);