[Openvas-commits] r3359 - in trunk/openvas-libraries: . libopenvas

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 13 15:47:04 CEST 2009


Author: mwiegand
Date: 2009-05-13 15:47:03 +0200 (Wed, 13 May 2009)
New Revision: 3359

Modified:
   trunk/openvas-libraries/ChangeLog
   trunk/openvas-libraries/libopenvas/store.c
Log:
* libopenvas/store.c: (store_plugin) Don't try to guess the path of the
NVT, this resulted in wrong paths. The filename is enough for the error
message built by safe_copy. (safe_copy) Display a more descriptive error
message. Clarified documentation, made variable name more fitting.


Modified: trunk/openvas-libraries/ChangeLog
===================================================================
--- trunk/openvas-libraries/ChangeLog	2009-05-13 10:41:26 UTC (rev 3358)
+++ trunk/openvas-libraries/ChangeLog	2009-05-13 13:47:03 UTC (rev 3359)
@@ -1,3 +1,10 @@
+2009-05-13  Michael Wiegand <michael.wiegand at intevation.de>
+
+	* libopenvas/store.c: (store_plugin) Don't try to guess the path of the
+	NVT, this resulted in wrong paths. The filename is enough for the error
+	message built by safe_copy. (safe_copy) Display a more descriptive error
+	message. Clarified documentation, made variable name more fitting.
+
 2009-05-05  Jan Wagner <waja at cyconet.org>
 
 	* packaging/debian/copyright, packaging/debian/changelog: Added some

Modified: trunk/openvas-libraries/libopenvas/store.c
===================================================================
--- trunk/openvas-libraries/libopenvas/store.c	2009-05-13 10:41:26 UTC (rev 3358)
+++ trunk/openvas-libraries/libopenvas/store.c	2009-05-13 13:47:03 UTC (rev 3359)
@@ -142,19 +142,20 @@
  * @brief Copies content of one string into the other.
  *
  * Does not check nul-termination.
- * If it failes, an error message will be printed, that is a bit specific to
- * plugin information (thus the path and item parameter).
+ * If it fails, an error message containing the name of the NVT and the
+ * description of the failed property will be printed to stderr.
  *
  * @param str Source string, might be NULL.
  * @param dst Destination string.
  * @param sz max number of bytes to copy into dst.
- * @param path Filename path for error message (!?).
- * @param item Description of what had to be copied for error message (!?).
+ * @param filename Filename of the NVT, used in the error message.
+ * @param item Description of the property to be copied, used in the error
+ * message.
  *
  * @return 0 on success, -1 otherwise.
  */
 static int
-safe_copy (char * str, char * dst, int sz, char * path, char * item)
+safe_copy (char * str, char * dst, int sz, char * filename, char * item)
 {
  if (str == NULL) /* empty strings are OK */
   {
@@ -164,7 +165,7 @@
 
  if (strlen(str) >= sz)
   {
-    fprintf(stderr, "openvas-libraries/libopenvas/store.c: %s has a too long %s (%ld)\n", path, item, (long) strlen(str));
+    fprintf(stderr, "\r%s: The length of the value for the property \"%s\" exceeds the allowed maximum length (is %ld characters, maximum length is %d).\n", filename, item, (long) strlen (str), sz);
     return -1;
   }
 
@@ -490,8 +491,7 @@
   gchar * dummy = g_build_filename (store_dir, file, NULL);
   gchar * desc_file = g_strconcat (dummy, ".desc", NULL);
   // assume there is a ".desc" at the end in the store_dir path
-  // in order to guess the path of the actual plugin:
-  gchar * path = g_build_filename (store_dir, "..", file, NULL);
+  gchar * path = g_strdup (file);
  struct plugin plug;
  struct pprefs pp[MAX_PREFS+1];
  char  * str;



More information about the Openvas-commits mailing list