summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Axboe <jens.axboe@oracle.com>2009-09-01 10:24:01 +0200
committerJens Axboe <jens.axboe@oracle.com>2009-09-01 10:24:01 +0200
commitcf6594424c9f81e1070f2ce8e0969d5c0fe59fe1 (patch)
tree4bc7d6df959ff09c1a3c535cb423f23d75459566
parent1e09f6e9012826fca69fa07222b7bc53c3e629ee (diff)
downloadblktrace-cf6594424c9f81e1070f2ce8e0969d5c0fe59fe1.tar.gz
blktrace-cf6594424c9f81e1070f2ce8e0969d5c0fe59fe1.tar.bz2
blkparse: allow stdout output with -d option (using '-' as the filename)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--blkparse.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/blkparse.c b/blkparse.c
index eec4952..5a49d6b 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -2840,11 +2840,15 @@ int main(int argc, char *argv[])
}
if (dump_binary) {
- dump_fp = fopen(dump_binary, "w");
- if (!dump_fp) {
- perror(dump_binary);
- dump_binary = NULL;
- return 1;
+ if (!strcmp(dump_binary, "-"))
+ dump_fp = stdout;
+ else {
+ dump_fp = fopen(dump_binary, "w");
+ if (!dump_fp) {
+ perror(dump_binary);
+ dump_binary = NULL;
+ return 1;
+ }
}
bin_ofp_buffer = malloc(128 * 1024);
if (setvbuf(dump_fp, bin_ofp_buffer, _IOFBF, 128 * 1024)) {