OSDN Git Service
(root)
/
qmiga
/
qemu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
hw/avr/atmega: Fix wrong initial value of stack pointer
[qmiga/qemu.git]
/
chardev
/
char-stdio.c
diff --git
a/chardev/char-stdio.c
b/chardev/char-stdio.c
index
be4a659
..
3c64867
100644
(file)
--- a/
chardev/char-stdio.c
+++ b/
chardev/char-stdio.c
@@
-21,18
+21,20
@@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
+
#include "qemu/osdep.h"
#include "qemu/osdep.h"
+#include "qemu/module.h"
+#include "qemu/option.h"
#include "qemu/sockets.h"
#include "qapi/error.h"
#include "qemu/sockets.h"
#include "qapi/error.h"
-#include "qemu-common.h"
-#include "sysemu/char.h"
+#include "chardev/char.h"
#ifdef _WIN32
#ifdef _WIN32
-#include "char-win.h"
-#include "char-win-stdio.h"
+#include "char
dev/char
-win.h"
+#include "char
dev/char
-win-stdio.h"
#else
#include <termios.h>
#else
#include <termios.h>
-#include "char-fd.h"
+#include "char
dev/char
-fd.h"
#endif
#ifndef _WIN32
#endif
#ifndef _WIN32
@@
-45,8
+47,10
@@
static bool stdio_echo_state;
static void term_exit(void)
{
static void term_exit(void)
{
- tcsetattr(0, TCSANOW, &oldtty);
- fcntl(0, F_SETFL, old_fd0_flags);
+ if (stdio_in_use) {
+ tcsetattr(0, TCSANOW, &oldtty);
+ fcntl(0, F_SETFL, old_fd0_flags);
+ }
}
static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
}
static void qemu_chr_set_echo_stdio(Chardev *chr, bool echo)
@@
-99,7
+103,10
@@
static void qemu_chr_open_stdio(Chardev *chr,
stdio_in_use = true;
old_fd0_flags = fcntl(0, F_GETFL);
tcgetattr(0, &oldtty);
stdio_in_use = true;
old_fd0_flags = fcntl(0, F_GETFL);
tcgetattr(0, &oldtty);
- qemu_set_nonblock(0);
+ if (!g_unix_set_fd_nonblocking(0, true, NULL)) {
+ error_setg_errno(errp, errno, "Failed to set FD nonblocking");
+ return;
+ }
atexit(term_exit);
memset(&act, 0, sizeof(act));
atexit(term_exit);
memset(&act, 0, sizeof(act));
@@
-108,9
+115,7
@@
static void qemu_chr_open_stdio(Chardev *chr,
qemu_chr_open_fd(chr, 0, 1);
qemu_chr_open_fd(chr, 0, 1);
- if (opts->has_signal) {
- stdio_allow_signal = opts->signal;
- }
+ stdio_allow_signal = !opts->has_signal || opts->signal;
qemu_chr_set_echo_stdio(chr, false);
}
#endif
qemu_chr_set_echo_stdio(chr, false);
}
#endif