diff --git a/src/manage_sql_secinfo.c b/src/manage_sql_secinfo.c index 18663176a..adc8d3dda 100644 --- a/src/manage_sql_secinfo.c +++ b/src/manage_sql_secinfo.c @@ -3062,7 +3062,7 @@ check_cert_db_version () * * @return 0 success, -1 error. */ -static int +static void update_cert_timestamp () { GError *error; @@ -3082,7 +3082,7 @@ update_cert_timestamp () g_warning ("%s: Failed to get timestamp: %s", __func__, error->message); - return -1; + stamp = time(NULL); } } else @@ -3093,22 +3093,22 @@ update_cert_timestamp () __func__, timestamp); g_free (timestamp); - return -1; + stamp = time(NULL); + } + else + { + timestamp[8] = '\0'; + g_debug ("%s: parsing: %s", __func__, timestamp); + stamp = parse_feed_timestamp (timestamp); + g_free (timestamp); + if (stamp == 0) + stamp = time(NULL); } - - timestamp[8] = '\0'; - g_debug ("%s: parsing: %s", __func__, timestamp); - stamp = parse_feed_timestamp (timestamp); - g_free (timestamp); - if (stamp == 0) - return -1; } g_debug ("%s: setting last_update: %lld", __func__, (long long) stamp); sql ("UPDATE cert.meta SET value = '%lld' WHERE name = 'last_update';", (long long) stamp); - - return 0; } /** @@ -3276,14 +3276,14 @@ sync_cert () g_debug ("%s: update timestamp", __func__); - if (update_cert_timestamp ()) - goto fail; + update_cert_timestamp (); g_info ("%s: Updating CERT info succeeded.", __func__); return 0; fail: + update_cert_timestamp (); return -1; } @@ -3333,7 +3333,7 @@ check_scap_db_version () * * @return 0 success, -1 error. */ -static int +static void update_scap_timestamp () { GError *error; @@ -3353,7 +3353,7 @@ update_scap_timestamp () g_warning ("%s: Failed to get timestamp: %s", __func__, error->message); - return -1; + stamp = time(NULL); } } else @@ -3364,22 +3364,22 @@ update_scap_timestamp () __func__, timestamp); g_free (timestamp); - return -1; + stamp = time(NULL); + } + else + { + timestamp[8] = '\0'; + g_debug ("%s: parsing: %s", __func__, timestamp); + stamp = parse_feed_timestamp (timestamp); + g_free (timestamp); + if (stamp == 0) + stamp = time(NULL); } - - timestamp[8] = '\0'; - g_debug ("%s: parsing: %s", __func__, timestamp); - stamp = parse_feed_timestamp (timestamp); - g_free (timestamp); - if (stamp == 0) - return -1; } g_debug ("%s: setting last_update: %lld", __func__, (long long) stamp); sql ("UPDATE scap2.meta SET value = '%lld' WHERE name = 'last_update';", (long long) stamp); - - return 0; } /** @@ -3436,8 +3436,7 @@ update_scap_end () g_debug ("%s: update timestamp", __func__); - if (update_scap_timestamp ()) - return -1; + update_scap_timestamp (); /* Replace the real scap schema with the new one. */ @@ -3657,13 +3656,19 @@ update_scap (gboolean reset_scap_db) setproctitle ("Syncing SCAP: Updating CPEs"); if (update_scap_cpes () == -1) - return -1; + { + update_scap_timestamp (); + return -1; + } g_debug ("%s: update cves", __func__); setproctitle ("Syncing SCAP: Updating CVEs"); if (update_scap_cves () == -1) - return -1; + { + update_scap_timestamp (); + return -1; + } g_debug ("%s: updating user defined data", __func__);