summaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-22 19:25:31 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2006-12-22 19:25:31 +0000
commitc26c1c4b3d5d4b7bd9f986ab67608419e7abefe1 (patch)
treeabb5ed90dd57fb2bed2c7bf077f302f8c6c2bbba /vl.c
parentc032e2a98c1c23bdd281ebf0aa4593e87813e1e0 (diff)
Support for unidirectional pipes, by Ed Swierk.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2267 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/vl.c b/vl.c
index 7e161c69c..b3e07acc5 100644
--- a/vl.c
+++ b/vl.c
@@ -1297,12 +1297,23 @@ CharDriverState *qemu_chr_open_file_out(const char *file_out)
CharDriverState *qemu_chr_open_pipe(const char *filename)
{
- int fd;
-
- fd = open(filename, O_RDWR | O_BINARY);
- if (fd < 0)
- return NULL;
- return qemu_chr_open_fd(fd, fd);
+ int fd_in, fd_out;
+ char filename_in[256], filename_out[256];
+
+ snprintf(filename_in, 256, "%s.in", filename);
+ snprintf(filename_out, 256, "%s.out", filename);
+ fd_in = open(filename_in, O_RDWR | O_BINARY);
+ fd_out = open(filename_out, O_RDWR | O_BINARY);
+ if (fd_in < 0 || fd_out < 0) {
+ if (fd_in >= 0)
+ close(fd_in);
+ if (fd_out >= 0)
+ close(fd_out);
+ fd_in = fd_out = open(filename, O_RDWR | O_BINARY);
+ if (fd_in < 0)
+ return NULL;
+ }
+ return qemu_chr_open_fd(fd_in, fd_out);
}