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.
This commit is contained in:
John "Elwin" Edwards 2014-01-06 09:11:35 -05:00
parent bc69ffcd64
commit 668f6d246d

View file

@ -1035,8 +1035,10 @@ function getStatus(callback) {
}
}
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);