5 Commits

Author SHA1 Message Date
Kim Woelders 00430e5f64 ttynvt version 0.11 2018-10-04 09:38:24 +02:00
Kim Woelders 1ded3b11d2 ICS-664: Fix "cu problem"
In ttynvt_read(), the "interrupted" signal may be delivered after
installing the handler (fuse_req_interrupt_func()) but before calling
read().
If this happens the signal intended to be delivered while in the read()
function call (SIGUSR2) is handled before the read(), and we may hang
indefinitely.
2018-10-04 09:32:02 +02:00
Kim Woelders bf21ada8c7 Indent 2018-10-03 15:06:52 +02:00
Frank Rolsted Jensen e68e140ef0 ttynvt version 0.10 2018-09-12 14:04:23 +02:00
Frank Rolsted Jensen 02a2149c1f Add LICENSE 2018-06-07 11:37:24 +00:00
2 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
m4_define([pkg_version], [0.10]) m4_define([pkg_version], [0.11])
#m4_define([pkg_revision], [005]) #m4_define([pkg_revision], [005])
m4_define([pkg_version], m4_ifdef([pkg_revision], [pkg_version.pkg_revision], [pkg_version])) m4_define([pkg_version], m4_ifdef([pkg_revision], [pkg_version.pkg_revision], [pkg_version]))
+12 -3
View File
@@ -99,9 +99,12 @@ _PRF2_ static void _log(int prio, const char *fmt, ...)
#define DBG2(...) \ #define DBG2(...) \
if (ttynvt_param.debug > 1) _log(LOG_DEBUG, __VA_ARGS__) if (ttynvt_param.debug > 1) _log(LOG_DEBUG, __VA_ARGS__)
static volatile char _is_interrupted = 0;
static void sig_handler(int sig) static void sig_handler(int sig)
{ {
DBG("Interruped, signal = %d\n", sig);
_is_interrupted = 1;
} }
static void set_signal_handler(void) static void set_signal_handler(void)
@@ -489,7 +492,9 @@ ttynvt_read(fuse_req_t req, size_t size, off_t off,
size = TMP_BUF_SIZE; size = TMP_BUF_SIZE;
fuse_req_interrupt_func(req, ttynvt_interrupted, (void *)pthread_self()); fuse_req_interrupt_func(req, ttynvt_interrupted, (void *)pthread_self());
res = read(tty->fds[FD_SLAVE].fd, tty->tmp_buf, size); res =
_is_interrupted ? -2 : read(tty->fds[FD_SLAVE].fd, tty->tmp_buf, size);
_is_interrupted = 0;
fuse_req_interrupt_func(req, NULL, NULL); fuse_req_interrupt_func(req, NULL, NULL);
if (res < 0) if (res < 0)
{ {
@@ -903,8 +908,12 @@ ttynvt_poll(fuse_req_t req, struct fuse_file_info *info,
static const struct cuse_lowlevel_ops ttynvt_op = { static const struct cuse_lowlevel_ops ttynvt_op = {
.init = ttynvt_init, .init = ttynvt_init,
.open = ttynvt_open,.read = ttynvt_read,.write = ttynvt_write,.ioctl = .open = ttynvt_open,
ttynvt_ioctl,.poll = ttynvt_poll,.release = ttynvt_release, .read = ttynvt_read,
.write = ttynvt_write,
.ioctl = ttynvt_ioctl,
.poll = ttynvt_poll,
.release = ttynvt_release,
}; };
#define TTYNET_OPT(t, p, v) { t, offsetof(struct ttynvt_param, p), v } #define TTYNET_OPT(t, p, v) { t, offsetof(struct ttynvt_param, p), v }