Browse Source

char-pty: Print "char device redirected" message to stdout

char_pty_open() prints a "char device redirected to PTY_NAME (label
LABEL)" message to the current monitor or else to stderr.  This is not
an error, so it shouldn't go to stderr.  Print it to stdout instead.

Why is it even printed?  No other ChardevClass::open() prints anything
on success.  It's because you need to know PTY_NAME to actually use
this char device, e.g. like e.g. "socat STDIO,cfmakeraw FILE:PTY_NAME"
to use the monitor's readline interface.  You can get PTY_NAME with
"info chardev" (a.k.a. query-chardev for QMP), but only if you already
have a monitor.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <2019041719.26814-15-armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
master
Markus Armbruster 2 months ago
parent
commit
6ade45f2ac
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      chardev/char-pty.c

+ 3
- 2
chardev/char-pty.c View File

@@ -28,6 +28,7 @@
28 28
 #include "io/channel-file.h"
29 29
 #include "qemu/sockets.h"
30 30
 #include "qemu/error-report.h"
31
+#include "qemu/qemu-print.h"
31 32
 
32 33
 #include "chardev/char-io.h"
33 34
 
@@ -211,8 +212,8 @@ static void char_pty_open(Chardev *chr,
211 212
     qemu_set_nonblock(master_fd);
212 213
 
213 214
     chr->filename = g_strdup_printf("pty:%s", pty_name);
214
-    error_printf("char device redirected to %s (label %s)\n",
215
-                 pty_name, chr->label);
215
+    qemu_printf("char device redirected to %s (label %s)\n",
216
+                pty_name, chr->label);
216 217
 
217 218
     s = PTY_CHARDEV(chr);
218 219
     s->ioc = QIO_CHANNEL(qio_channel_file_new_fd(master_fd));

Loading…
Cancel
Save