[Openvas-commits] r13716 - in trunk/openvas-libraries: . misc

scm-commit at wald.intevation.org scm-commit at wald.intevation.org
Tue Jul 10 23:29:10 CEST 2012


Author: jan
Date: 2012-07-10 23:29:10 +0200 (Tue, 10 Jul 2012)
New Revision: 13716

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/misc/store.c
Log:
* misc/store.c (store_plugin): Reduced code by using new function
nvticache_add().



Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2012-07-10 21:11:50 UTC (rev 13715)
+++ trunk/openvas-libraries/ChangeLog	2012-07-10 21:29:10 UTC (rev 13716)
@@ -1,5 +1,10 @@
 2012-07-10  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
 
+	* misc/store.c (store_plugin): Reduced code by using new function
+	nvticache_add().
+
+2012-07-10  Jan-Oliver Wagner <jan-oliver.wagner at greenbone.net>
+
 	* base/nvticache.c (nvticache_add): New function to write a nvti file
 	to the cache.
 

Modified: trunk/openvas-libraries/misc/store.c
===================================================================
--- trunk/openvas-libraries/misc/store.c	2012-07-10 21:11:50 UTC (rev 13715)
+++ trunk/openvas-libraries/misc/store.c	2012-07-10 21:29:10 UTC (rev 13716)
@@ -208,23 +208,16 @@
 void
 store_plugin (struct arglist *plugin, char *file)
 {
-  gchar *dummy = g_build_filename (nvti_cache->cache_path, file, NULL);
-  gchar *desc_file = g_strconcat (dummy, ".nvti", NULL);
-  // assume there is a ".nvti" at the end in the cache path
-
-  g_free (dummy);
-
-  if (desc_file == NULL)
-    return;                   // g_build_filename failed
-
   nvti_t *n = arg_get_value (plugin, "NVTI");
   if (!n) n = nvti_new();
 
-  nvti_to_keyfile (n, desc_file);
+  if (nvticache_add (nvti_cache, n, file))
+    {
+      nvti_free (n);
+      return;
+    }
   nvti_free (n);
 
   arg_set_value (plugin, "preferences", -1, NULL);
   arg_free_all (plugin);
-
-  g_free (desc_file);
 }



More information about the Openvas-commits mailing list