[sheepdog] [PATCH 3/4] trace: fix trace-cat commind for empty trace file

Liu Yuan namei.unix at gmail.com
Tue Apr 16 10:37:53 CEST 2013


From: Liu Yuan <tailai.ly at taobao.com>

Signed-off-by: Liu Yuan <tailai.ly at taobao.com>
---
 collie/debug.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/collie/debug.c b/collie/debug.c
index ace5737..83dbf8f 100644
--- a/collie/debug.c
+++ b/collie/debug.c
@@ -168,6 +168,9 @@ static int trace_cat(int argc, char **argv)
 		return EXIT_SYSFAIL;
 	}
 
+	if (st.st_size == 0)
+		return EXIT_SUCCESS;
+
 	map = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
 	close(fd);
 	if (map == MAP_FAILED) {
-- 
1.7.9.5




More information about the sheepdog mailing list