Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions src/logcollector/logcollector.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ void LogCollectorStart()
time_t curr_time = 0;
char keepalive[1024];

/* To check for inode changes */
struct stat tmp_stat;

#ifndef WIN32
int int_error = 0;
struct timeval fp_timeout;
/* To check for inode changes */
struct stat tmp_stat;
#else
BY_HANDLE_FILE_INFORMATION lpFileInformation;

/* Check if we are on Windows Vista */
checkVista();
Expand Down Expand Up @@ -412,7 +413,6 @@ void LogCollectorStart()
merror("Closing the temporary file %s did not work (%d): %s", logff[i].file, errno, strerror(errno));
}
#else
BY_HANDLE_FILE_INFORMATION lpFileInformation;
HANDLE h1;

h1 = CreateFile(logff[i].file, GENERIC_READ,
Expand Down Expand Up @@ -481,10 +481,6 @@ void LogCollectorStart()
debug1("%s: DEBUG: File size reduced. %s",
ARGV0, logff[i].file);


/* Fix size so we don't alert more than once */
logff[i].size = tmp_stat.st_size;

/* Get new file */
fclose(logff[i].fp);

Expand Down Expand Up @@ -544,6 +540,13 @@ void LogCollectorStart()
continue;
}
}

/* Update file size */
#ifdef WIN32
logff[i].size = lpFileInformation.nFileSizeHigh + lpFileInformation.nFileSizeLow;
#else
logff[i].size = tmp_stat.st_size;
#endif
}
}
}
Expand Down