Mercurial > hg > rlgwebd
comparison 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 |
comparison
equal
deleted
inserted
replaced
147:8d6bf19d8227 | 148:bac9c3b01692 |
---|---|
1033 else | 1033 else |
1034 idleset(i, now - stats.mtime); | 1034 idleset(i, now - stats.mtime); |
1035 } | 1035 } |
1036 } | 1036 } |
1037 for (var i = 0; i < statusinfo.g.length; i++) { | 1037 for (var i = 0; i < statusinfo.g.length; i++) { |
1038 if (statusinfo.g[i].n in sessions) { | 1038 /* fd sometimes isn't a number, presumably when the file isn't open yet. */ |
1039 fs.fstat(sessions[statusinfo.g[i].n].record.fd, makecallback(i)); | 1039 var ssid = statusinfo.g[i].n; |
1040 if (ssid in sessions && typeof(sessions[ssid].record.fd) == 'number') { | |
1041 fs.fstat(sessions[ssid].record.fd, makecallback(i)); | |
1040 } | 1042 } |
1041 else { | 1043 else { |
1042 idleset(i, null); | 1044 idleset(i, null); |
1043 } | 1045 } |
1044 } | 1046 } |