summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan D. Brunelle <Alan.Brunelle@hp.com>2006-12-19 08:18:38 +0100
committerJens Axboe <jens.axboe@oracle.com>2006-12-19 08:18:38 +0100
commit8afe3d7d64eaae67e96ea48af2d98df1e15cfc65 (patch)
tree0309d77677e71f3980e2be873f64e8d984a8c44b
parentfe92fbb89695321292b6bf97cffdab72836a999a (diff)
downloadblktrace-8afe3d7d64eaae67e96ea48af2d98df1e15cfc65.tar.gz
blktrace-8afe3d7d64eaae67e96ea48af2d98df1e15cfc65.tar.bz2
PATCH: blkparse: fix probem with empty trace files stopping the check for other files
Fix problem where empty input files cause premature parsing of files. Had a problem where CPU 0 opened a file with 0 traces, and that caused the run to end before processing other trace files. Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
-rw-r--r--blkparse.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/blkparse.c b/blkparse.c
index bded2f8..0d2ea12 100644
--- a/blkparse.c
+++ b/blkparse.c
@@ -2249,8 +2249,10 @@ static int setup_file(struct per_dev_info *pdi, int cpu)
snprintf(pci->fname + len, sizeof(pci->fname)-1-len,
"%s.blktrace.%d", pdi->name, pci->cpu);
- if (stat(pci->fname, &st) < 0 || !st.st_size)
+ if (stat(pci->fname, &st) < 0)
return 0;
+ if (!st.st_size)
+ return 1;
pci->fd = open(pci->fname, O_RDONLY);
if (pci->fd < 0) {