diff options
author | William Jon McCann <mccann@jhu.edu> | 2008-02-01 14:20:00 -0500 |
---|---|---|
committer | William Jon McCann <mccann@jhu.edu> | 2008-02-01 14:20:00 -0500 |
commit | 076d63698c204427b210a2da76dc1b7e6640bbb9 (patch) | |
tree | 4d7f586953e349c6a578272dc68b6f2de9c13e74 | |
parent | 185c0f5169dbcb55854491d9ab642c7b5c6418ca (diff) |
when a parsing error occurs don't return an empty event
-rw-r--r-- | src/ck-log-event.c | 21 | ||||
-rw-r--r-- | tools/ck-history.c | 12 |
2 files changed, 19 insertions, 14 deletions
diff --git a/src/ck-log-event.c b/src/ck-log-event.c index f099b89..7e8ce10 100644 --- a/src/ck-log-event.c +++ b/src/ck-log-event.c @@ -711,7 +711,7 @@ parse_log_for_seat_added (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse seat added event: %s", s); goto out; } @@ -771,7 +771,7 @@ parse_log_for_seat_removed (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse seat removed event: %s", s); goto out; } @@ -900,7 +900,7 @@ parse_log_for_seat_session_added (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse session added event: %s", s); goto out; } @@ -975,7 +975,7 @@ parse_log_for_seat_session_removed (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse session removed event: %s", s); goto out; } @@ -1049,7 +1049,7 @@ parse_log_for_seat_active_session_changed (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse session changed event: %s", s); goto out; } @@ -1101,7 +1101,7 @@ parse_log_for_seat_device_added (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse device added event: %s", s); goto out; } @@ -1154,7 +1154,7 @@ parse_log_for_seat_device_removed (const GString *str, res = g_match_info_matches (match_info); if (! res) { - g_warning ("Unable to parse event: %s", s); + g_warning ("Unable to parse device removed event: %s", s); goto out; } @@ -1269,11 +1269,16 @@ CkLogEvent * ck_log_event_new_from_string (const GString *str) { CkLogEvent *event; + gboolean res; g_return_val_if_fail (str != NULL, NULL); event = g_new0 (CkLogEvent, 1); - ck_log_event_fill_from_string (event, str); + res = ck_log_event_fill_from_string (event, str); + if (! res) { + g_free (event); + event = NULL; + } return event; } diff --git a/tools/ck-history.c b/tools/ck-history.c index 8f96a9b..716c3ef 100644 --- a/tools/ck-history.c +++ b/tools/ck-history.c @@ -566,11 +566,11 @@ generate_report_last (int uid, continue; } - if (seat != NULL && strcmp (e->seat_id, seat) != 0) { + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { continue; } - if (session_type != NULL && strcmp (e->session_type, session_type) != 0) { + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { continue; } } @@ -609,11 +609,11 @@ generate_report_last_compat (int uid, continue; } - if (seat != NULL && strcmp (e->seat_id, seat) != 0) { + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { continue; } - if (session_type != NULL && strcmp (e->session_type, session_type) != 0) { + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { continue; } } @@ -689,11 +689,11 @@ generate_report_frequent (int uid, continue; } - if (seat != NULL && strcmp (e->seat_id, seat) != 0) { + if (seat != NULL && e->seat_id != NULL && strcmp (e->seat_id, seat) != 0) { continue; } - if (session_type != NULL && strcmp (e->session_type, session_type) != 0) { + if (session_type != NULL && e->session_type != NULL && strcmp (e->session_type, session_type) != 0) { continue; } |