From 6e0073ed0b872275aa6271b2daaaba6a0ab8019e Mon Sep 17 00:00:00 2001 From: Jens Axboe Date: Tue, 11 Oct 2005 09:50:47 +0200 Subject: [PATCH] [PATCH] blkparse: be a little more flexible in mixing -i and -D --- blkparse.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/blkparse.c b/blkparse.c index 8f94a1a..1b5ab4e 100644 --- a/blkparse.c +++ b/blkparse.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "blktrace.h" #include "rbtree.h" @@ -1660,10 +1661,20 @@ static int do_file(void) for (j = 0;; j++) { struct stat st; int len = 0; + char *p, *dname; pci = get_cpu_info(pdi, j); pci->cpu = j; pci->fd = -1; + + p = strdup(pdi->name); + dname = dirname(p); + if (strcmp(dname, ".")) { + input_dir = dname; + p = strdup(pdi->name); + strcpy(pdi->name, basename(p)); + } + free(p); if (input_dir) len = sprintf(pci->fname, "%s/", input_dir); -- 2.25.1