Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r729 committed - Fix bug due to which compression of ndttrace/snaplog/cputime log files...

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r729 committed - Fix bug due to which compression of ndttrace/snaplog/cputime log files...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r729 committed - Fix bug due to which compression of ndttrace/snaplog/cputime log files...
  • Date: Thu, 20 Oct 2011 02:27:36 +0000

Revision: 729
Author:

Date: Wed Oct 19 19:26:33 2011
Log: Fix bug due to which compression of ndttrace/snaplog/cputime log files fails
http://code.google.com/p/ndt/source/detail?r=729

Modified:
/branches/kkumar_code_organize/src/logging.c

=======================================
--- /branches/kkumar_code_organize/src/logging.c Tue Oct 18 09:01:08
2011
+++ /branches/kkumar_code_organize/src/logging.c Wed Oct 19 19:26:33
2011
@@ -784,7 +784,11 @@

void writeMeta(int compress, int cputime, int snaplog, int tcpdump) {
FILE * fp;
- char tmpstr[256], dir[128], tmp2str[256];
+ char tmpstr[256], dir[128];
+ char dirpathstr[256]="";
+ char *tempptr;
+ int ptrdiff=0;
+
char isoTime[64], filename[256];
size_t tmpstrlen = sizeof(tmpstr);
socklen_t len;
@@ -828,25 +832,31 @@

// If compression is enabled, compress files in the "log" directory
if (compress == 1) {
+ // Get directory/path
+ tempptr = strstr(tmpstr, metafilesuffix);
+ if (tempptr != NULL) {
+ ptrdiff = tempptr - tmpstr;
+ strlcpy(dirpathstr, tmpstr, ptrdiff);
+ } //obtained directory in "dirpathstr"
log_println(5,
"Compression is enabled, compress all files in
'%s' basedir",
- tmp2str);
+ dirpathstr);
if (snaplog) { // if snaplog is enabled, compress those into
.gz formats

// Try compressing C->S test snaplogs
memset(filename, 0, 256);
- sprintf(filename, "%s/%s", tmp2str, meta.c2s_snaplog);
+ sprintf(filename, "%s/%s", dirpathstr,
meta.c2s_snaplog);
if (zlib_def(filename) != 0)
- log_println(5, "compression failed for file:%s:
%s.", filename,
- tmp2str);
+ log_println(0, "compression failed for file:%s:
%s.", filename,
+ dirpathstr);
else
strlcat(meta.c2s_snaplog, ".gz",
sizeof(meta.c2s_snaplog));

// Try compressing S->C test snaplogs
memset(filename, 0, 256);
- sprintf(filename, "%s/%s", tmp2str, meta.s2c_snaplog);
+ sprintf(filename, "%s/%s", dirpathstr,
meta.s2c_snaplog);
if (zlib_def(filename) != 0)
- log_println(5, "compression failed for file
:%s", filename);
+ log_println(0, "compression failed for file
:%s", filename);
else
strlcat(meta.s2c_snaplog, ".gz",
sizeof(meta.s2c_snaplog));
}
@@ -857,18 +867,18 @@
// Try compressing C->S test tcpdump.
// The tcpdump file extension is as specified in the "meta" data-structure
memset(filename, 0, 256);
- sprintf(filename, "%s/%s", tmp2str,
meta.c2s_ndttrace);
+ sprintf(filename, "%s/%s", dirpathstr,
meta.c2s_ndttrace);
if (zlib_def(filename) != 0)
- log_println(5, "compression failed for tcpdump
file %s =%s",
+ log_println(0, "compression failed for tcpdump
file %s =%s",
filename, meta.c2s_ndttrace);
else
strlcat(meta.c2s_ndttrace, ".gz",
sizeof(meta.c2s_ndttrace));

// Try compressing S->C test tcpdumps
memset(filename, 0, 256);
- sprintf(filename, "%s/%s", tmp2str,
meta.s2c_ndttrace);
+ sprintf(filename, "%s/%s", dirpathstr,
meta.s2c_ndttrace);
if (zlib_def(filename) != 0)
- log_println(5, "compression failed for tcpdump
file %s =%s",
+ log_println(0, "compression failed for tcpdump
file %s =%s",
filename, meta.s2c_ndttrace);
else
strlcat(meta.s2c_ndttrace, ".gz",
sizeof(meta.s2c_ndttrace));
@@ -877,9 +887,9 @@
// If writing "cputime" file is enabled, compress those log
files too
if (cputime) {
memset(filename, 0, 256);
- sprintf(filename, "%s/%s", tmp2str, meta.CPU_time);
+ sprintf(filename, "%s/%s", dirpathstr, meta.CPU_time);
if (zlib_def(filename) != 0)
- log_println(5, "compression failed");
+ log_println(0, "compression failed");
else
strlcat(meta.CPU_time, ".gz",
sizeof(meta.CPU_time));
} else


  • [ndt-dev] [ndt] r729 committed - Fix bug due to which compression of ndttrace/snaplog/cputime log files..., ndt, 10/19/2011

Archive powered by MHonArc 2.6.16.

Top of Page