Skip to content

Commit

Permalink
Merge pull request #1159 from jjnicola/get-feed-version
Browse files Browse the repository at this point in the history
Use error variable in osp_get_vts_version(),
  • Loading branch information
mattmundell authored Jun 29, 2020
2 parents e247f60 + b0a6d1c commit c895627
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Do not ignore empty hosts_allow and ifaces_allow [#1064](https://github.com/greenbone/gvmd/pull/1064)
- Reduce the memory cache of NVTs [#1076](https://github.com/greenbone/gvmd/pull/1076)
- Sync SCAP using a second schema [#1111](https://github.com/greenbone/gvmd/pull/1111)
- Use error variable in osp_get_vts_version(). [#1159](https://github.com/greenbone/gvmd/pull/1159)

### Fixed
- Add NULL check in nvts_feed_version_epoch [#768](https://github.com/greenbone/gvmd/pull/768)
Expand Down
16 changes: 12 additions & 4 deletions src/manage_sql_nvts.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,7 @@ update_nvt_cache_osp (const gchar *update_socket, gchar *db_feed_version,
return -1;
}

get_vts_opts = osp_get_vts_opts_default;
if (db_feed_version)
get_vts_opts.filter = g_strdup_printf ("modification_time>%s", db_feed_version);
else
Expand Down Expand Up @@ -1799,6 +1800,7 @@ manage_update_nvt_cache_osp (const gchar *update_socket)
{
osp_connection_t *connection;
gchar *db_feed_version, *scanner_feed_version;
gchar *error;

/* Re-open DB after fork. */

Expand All @@ -1817,9 +1819,12 @@ manage_update_nvt_cache_osp (const gchar *update_socket)
return -1;
}

if (osp_get_vts_version (connection, &scanner_feed_version))
error = NULL;
if (osp_get_vts_version (connection, &scanner_feed_version, &error))
{
g_debug ("%s: failed to get scanner_version", __func__);
g_debug ("%s: failed to get scanner_feed_version. %s",
__func__, error ? : "");
g_free (error);
return -1;
}
g_debug ("%s: scanner_feed_version: %s", __func__, scanner_feed_version);
Expand Down Expand Up @@ -1870,6 +1875,7 @@ update_or_rebuild_nvts (int update)
gchar *db_feed_version, *scanner_feed_version;
osp_connection_t *connection;
int ret;
gchar *error;

if (check_osp_vt_update_socket ())
{
Expand All @@ -1896,9 +1902,11 @@ update_or_rebuild_nvts (int update)
return -1;
}

if (osp_get_vts_version (connection, &scanner_feed_version))
error = NULL;
if (osp_get_vts_version (connection, &scanner_feed_version, &error))
{
printf ("Failed to get scanner_version.\n");
printf ("Failed to get scanner_version. %s\n", error ? : "");
g_free (error);
return -1;
}
g_debug ("%s: scanner_feed_version: %s", __func__, scanner_feed_version);
Expand Down

0 comments on commit c895627

Please sign in to comment.