diff mbox

Do not ignore error, if open file failed (-serial /dev/tty)

Message ID 20100128184446.GA21065@rain
State New
Headers show

Commit Message

Evgeniy Dushistov Jan. 28, 2010, 6:44 p.m. UTC
In case, when qemu is executed with option like
-serial /dev/ttyS0, report if there are problems with
opening of devices. At now errors are silently ignoring.

Signed-off-by: Evgeniy Dushistov <dushistov@mail.ru>
---
 qemu-char.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

Comments

Anthony Liguori Feb. 10, 2010, 6:31 p.m. UTC | #1
On 01/28/2010 12:44 PM, Evgeniy Dushistov wrote:
> In case, when qemu is executed with option like
> -serial /dev/ttyS0, report if there are problems with
> opening of devices. At now errors are silently ignoring.
>
> Signed-off-by: Evgeniy Dushistov<dushistov@mail.ru>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   qemu-char.c |    3 +++
>   1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/qemu-char.c b/qemu-char.c
> index 800ee6c..75dbf66 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -1180,6 +1180,9 @@ static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
>       int fd;
>
>       TFR(fd = open(filename, O_RDWR | O_NONBLOCK));
> +    if (fd<  0) {
> +        return NULL;
> +    }
>       tty_serial_init(fd, 115200, 'N', 8, 1);
>       chr = qemu_chr_open_fd(fd, fd);
>       if (!chr) {
>
diff mbox

Patch

diff --git a/qemu-char.c b/qemu-char.c
index 800ee6c..75dbf66 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -1180,6 +1180,9 @@  static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
     int fd;
 
     TFR(fd = open(filename, O_RDWR | O_NONBLOCK));
+    if (fd < 0) {
+        return NULL;
+    }
     tty_serial_init(fd, 115200, 'N', 8, 1);
     chr = qemu_chr_open_fd(fd, fd);
     if (!chr) {