tty.c: Refactor, move LIST_REMOVE() to tty_unregister()
@@ -119,7 +119,6 @@ void tty_sweep(void)
if (tty->dirty == -1) {
_d("TTY %s removed, cleaning up.", tty->data.name);
- LIST_REMOVE(tty, link);
tty_unregister(tty);
}
}
@@ -292,6 +291,8 @@ int tty_unregister(tty_node_t *tty)
return errno = EINVAL;
}
+ LIST_REMOVE(tty, link);
+
if (tty->data.name)
free(tty->data.name);
if (tty->data.baud)
