We can block in a tty open, which if another open then occurs leaves
the staticfast "ino" corrupted. Save it in a temporary variable so that
for we still get almost all the benefit of staticfast here.
int8_t uindex;
int8_t oftindex;
staticfast inoptr ino;
+ inoptr itmp;
int16_t perm;
staticfast inoptr parent;
char fname[FILENAME_LEN + 1];
udata.u_error = EISDIR;
goto cantopen;
}
+ itmp = ino;
+ /* d_open may block and thus ino may become invalid as may
+ parent (but we don't need it again) */
if (isdevice(ino)
&& d_open((int) ino->c_node.i_addr[0], flag) != 0) {
udata.u_error = ENXIO;
goto cantopen;
}
+ /* get the static pointer back */
+ ino = itmp;
if (trunc && getmode(ino) == F_REG) {
f_trunc(ino);
for (j = 0; j < OFTSIZE; ++j)
&& !(flag & O_NDELAY))
psleep(ino);
+ /* From the moment of the psleep ino is invalid */
+
return (uindex);
idrop:
i_deref(ino);