|
|
51da2d |
From ce90f916fee2a39eb914f8b6b349adb76d100f75 Mon Sep 17 00:00:00 2001
|
|
|
51da2d |
From: Sebastien GODARD <sysstat@users.noreply.github.com>
|
|
|
51da2d |
Date: Sat, 13 Apr 2019 18:44:29 +0200
|
|
|
51da2d |
Subject: [PATCH] sadf: Fix seg fault on empty data files
|
|
|
51da2d |
|
|
|
51da2d |
Trying to display XML or JSON data (with sadf -x/-j) from a data file
|
|
|
51da2d |
containing only RESTART records created a core dump.
|
|
|
51da2d |
This patch fixes that.
|
|
|
51da2d |
|
|
|
51da2d |
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
|
|
|
51da2d |
---
|
|
|
51da2d |
sadf.c | 7 ++++---
|
|
|
51da2d |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
51da2d |
|
|
|
51da2d |
diff --git a/sadf.c b/sadf.c
|
|
|
51da2d |
index 2d2c39c..5d558d3 100644
|
|
|
51da2d |
--- a/sadf.c
|
|
|
51da2d |
+++ b/sadf.c
|
|
|
51da2d |
@@ -963,14 +963,15 @@ void logic1_display_loop(int ifd, struct file_activity *file_actlst, char *file,
|
|
|
51da2d |
(tm_start.use && (datecmp(loctime, &tm_start) < 0)) ||
|
|
|
51da2d |
(tm_end.use && (datecmp(loctime, &tm_end) >= 0))));
|
|
|
51da2d |
|
|
|
51da2d |
- /* Save the first stats collected. Used for example in next_slice() function */
|
|
|
51da2d |
- copy_structures(act, id_seq, record_hdr, 2, 0);
|
|
|
51da2d |
-
|
|
|
51da2d |
curr = 1;
|
|
|
51da2d |
cnt = count;
|
|
|
51da2d |
reset = TRUE;
|
|
|
51da2d |
|
|
|
51da2d |
if (!eosaf) {
|
|
|
51da2d |
+
|
|
|
51da2d |
+ /* Save the first stats collected. Used for example in next_slice() function */
|
|
|
51da2d |
+ copy_structures(act, id_seq, record_hdr, 2, 0);
|
|
|
51da2d |
+
|
|
|
51da2d |
do {
|
|
|
51da2d |
eosaf = read_next_sample(ifd, IGNORE_COMMENT | IGNORE_RESTART, curr,
|
|
|
51da2d |
file, &rtype, tab, file_magic, file_actlst,
|
|
|
51da2d |
--
|
|
|
51da2d |
2.31.1
|
|
|
51da2d |
|