ttynvt_ioctl(): Cleanups around TCSET.. handling

Avoid nested switches and unnecessary block level.
This commit is contained in:
Kim Woelders
2021-06-18 07:18:01 +02:00
parent 0b402cdb6b
commit 42a4e2e062
+4 -14
View File
@@ -798,16 +798,6 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
_ioctl_name(cmd), arg, in_buf,
(unsigned int)in_bufsz, (unsigned int)out_bufsz);
switch (cmd)
{
case TCSETSF:
case TCSETSW:
case TCSETS:
/* BEWARE of termios/termios2 buf structure difference! */
case TCSETSF2:
case TCSETSW2:
case TCSETS2:
{
switch (cmd)
{
case TCSETSF:
@@ -816,15 +806,16 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
CHECK_BUF_IN(sizeof(struct termios));
memcpy(tio, in_buf, in_bufsz);
byte4 = htonl(_tio_baud(tio));
break;
goto do_tcset;
case TCSETSF2:
case TCSETSW2:
case TCSETS2:
CHECK_BUF_IN(sizeof(struct termios2));
memcpy(tio, in_buf, in_bufsz);
byte4 = htonl(_tio2_baud(tio));
break;
}
goto do_tcset;
do_tcset:
/* BEWARE of termios/termios2 buf structure difference! */
telnet_rfc2217_cfg(tty->tn, TNS_SET_BAUDRATE, &byte4, 4);
byte = _tio_csize(tio);
@@ -872,7 +863,6 @@ ttynvt_ioctl(fuse_req_t req, int cmd, void *arg,
tty->slave_suspended = 0; /* Re-enable polling of Slave */
fuse_reply_ioctl(req, 0, 0, 0);
}
break;
case TCGETS:
CHECK_BUF_OUT(sizeof(struct termios));