__tty_open(): use the correct type for saved_flags