]> git.proxmox.com Git - qemu.git/blobdiff - qemu-char.c
qcow2: Fail write_compressed when overwriting data
[qemu.git] / qemu-char.c
index 368df2e7be53b872a1a2e821da9b2503acb5466f..74c60e11a03d5e124ae79fa05ab2ac69bc190936 100644 (file)
@@ -177,6 +177,7 @@ void qemu_chr_accept_input(CharDriverState *s)
 {
     if (s->chr_accept_input)
         s->chr_accept_input(s);
+    qemu_notify_event();
 }
 
 void qemu_chr_fe_printf(CharDriverState *s, const char *fmt, ...)
@@ -640,8 +641,9 @@ static CharDriverState *qemu_chr_open_file_out(QemuOpts *opts)
 
     TFR(fd_out = qemu_open(qemu_opt_get(opts, "path"),
                       O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0666));
-    if (fd_out < 0)
+    if (fd_out < 0) {
         return NULL;
+    }
     return qemu_chr_open_fd(-1, fd_out);
 }
 
@@ -666,8 +668,9 @@ static CharDriverState *qemu_chr_open_pipe(QemuOpts *opts)
        if (fd_out >= 0)
            close(fd_out);
         TFR(fd_in = fd_out = qemu_open(filename, O_RDWR | O_BINARY));
-        if (fd_in < 0)
+        if (fd_in < 0) {
             return NULL;
+        }
     }
     return qemu_chr_open_fd(fd_in, fd_out);
 }
@@ -764,8 +767,9 @@ static CharDriverState *qemu_chr_open_stdio(QemuOpts *opts)
 {
     CharDriverState *chr;
 
-    if (stdio_nb_clients >= STDIO_MAX_CLIENTS)
+    if (stdio_nb_clients >= STDIO_MAX_CLIENTS) {
         return NULL;
+    }
     if (stdio_nb_clients == 0) {
         old_fd0_flags = fcntl(0, F_GETFL);
         tcgetattr (0, &oldtty);
@@ -1223,10 +1227,6 @@ static CharDriverState *qemu_chr_open_tty(QemuOpts *opts)
     }
     tty_serial_init(fd, 115200, 'N', 8, 1);
     chr = qemu_chr_open_fd(fd, fd);
-    if (!chr) {
-        close(fd);
-        return NULL;
-    }
     chr->chr_ioctl = tty_serial_ioctl;
     chr->chr_close = qemu_chr_close_tty;
     return chr;
@@ -1356,8 +1356,9 @@ static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
     int fd;
 
     TFR(fd = qemu_open(filename, O_RDWR));
-    if (fd < 0)
+    if (fd < 0) {
         return NULL;
+    }
 
     if (ioctl(fd, PPCLAIM) < 0) {
         close(fd);
@@ -1425,8 +1426,9 @@ static CharDriverState *qemu_chr_open_pp(QemuOpts *opts)
     int fd;
 
     fd = qemu_open(filename, O_RDWR);
-    if (fd < 0)
+    if (fd < 0) {
         return NULL;
+    }
 
     chr = g_malloc0(sizeof(CharDriverState));
     chr->opaque = (void *)(intptr_t)fd;
@@ -1795,8 +1797,9 @@ static CharDriverState *qemu_chr_open_win_file_out(QemuOpts *opts)
 
     fd_out = CreateFile(file_out, GENERIC_WRITE, FILE_SHARE_READ, NULL,
                         OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-    if (fd_out == INVALID_HANDLE_VALUE)
+    if (fd_out == INVALID_HANDLE_VALUE) {
         return NULL;
+    }
 
     return qemu_chr_open_win_file(fd_out);
 }
@@ -2444,8 +2447,9 @@ static CharDriverState *qemu_chr_open_socket(QemuOpts *opts)
             fd = inet_connect_opts(opts);
         }
     }
-    if (fd < 0)
+    if (fd < 0) {
         goto fail;
+    }
 
     if (!is_waitconnect)
         socket_set_nonblock(fd);