[Openvas-commits] r3267 - trunk/winslad

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed May 6 23:58:54 CEST 2009


Author: doj
Date: 2009-05-06 23:58:54 +0200 (Wed, 06 May 2009)
New Revision: 3267

Modified:
   trunk/winslad/client.cpp
Log:
timestamps are now inside a XML comment at the end

Modified: trunk/winslad/client.cpp
===================================================================
--- trunk/winslad/client.cpp	2009-05-06 21:58:36 UTC (rev 3266)
+++ trunk/winslad/client.cpp	2009-05-06 21:58:54 UTC (rev 3267)
@@ -436,24 +436,7 @@
       return -1;
     }
 
-  // print START timestamp to result file
   const time_t start_t=time(NULL);
-  {
-    char *ts=asctime(localtime(&start_t));
-    ts[strlen(ts)-1]=0;	// remove newline character
-    char buf[256];
-    _snprintf(buf, sizeof(buf), "START %s = %s (%u)\r\n", pluginName.c_str(), ts, static_cast<unsigned>(start_t));
-    DWORD written;
-    if(!WriteFile(result_h, buf, strlen(buf), &written, NULL))
-      {
-	PRINTF("WriteFile(%s) failed to write START\r\n", resultPath.c_str());
-	DisplayError("WriteFile");
-	CloseHandle(result_h);
-	return -1;
-      }
-    if(written != strlen(buf))
-      PRINTF("WriteFile did not write all bytes\r\n");
-  }
 
   // Info on CreateProcess: http://msdn.microsoft.com/en-us/library/ms682425(VS.85).aspx
 
@@ -500,13 +483,25 @@
       DisplayError("CreateProcess");
     }
 
-  // print END timestamp to result file
+  // print timestamps to result file
   {
     const time_t end_t=time(NULL);
-    char *ts=asctime(localtime(&end_t));
-    ts[strlen(ts)-1]=0;	// remove newline character
-    char buf[512];
-    _snprintf(buf, sizeof(buf), "\r\nEND %s = %s (%u)\r\nRUNTIME %s = %u seconds\r\n", pluginName.c_str(), ts, static_cast<unsigned>(end_t), pluginName.c_str(), static_cast<unsigned>(end_t-start_t));
+    char *end_ts=asctime(localtime(&end_t));
+    end_ts[strlen(end_ts)-1]=0;	// remove newline character
+
+    char *start_ts=asctime(localtime(&start_t));
+    start_ts[strlen(start_ts)-1]=0;	// remove newline character
+
+    const char *plugin_name=pluginName.c_str();
+
+    char buf[256*3];
+    _snprintf(buf, sizeof(buf), "\r\n"
+	      "<!-- START %s = %s (%u)\r\n"
+	      "       END %s = %s (%u)\r\n"
+	      "   RUNTIME %s = %u seconds -->\r\n",
+	      plugin_name, start_ts, static_cast<unsigned>(start_t),
+	      plugin_name, end_ts, static_cast<unsigned>(end_t),
+	      plugin_name, static_cast<unsigned>(end_t-start_t));
     DWORD written;
     if(!WriteFile(result_h, buf, strlen(buf), &written, NULL))
       {



More information about the Openvas-commits mailing list