Fixed issue 45 (only --post-size rewrites old log)

git-svn-id: https://logkeys.googlecode.com/svn/trunk@93 c501e62c-e7d1-11de-a198-37193048d1ed
This commit is contained in:
kernc 2012-01-10 10:31:44 +00:00
parent aa0812690d
commit 59976aed4e
1 changed files with 11 additions and 3 deletions

View File

@ -510,14 +510,22 @@ int main(int argc, char **argv)
error(EXIT_FAILURE, errno, "Error opening output file '%s'", args.logfile.c_str());
file_size = 0; // new log file is now empty
// TODO: write new timestamp
switch (fork())
{
// write new timestamp
time(&cur_time);
strftime(timestamp, sizeof(timestamp), TIME_FORMAT, localtime(&cur_time));
if (args.flags & FLAG_NO_TIMESTAMPS)
file_size += fprintf(out, "Logging started at %s\n\n", timestamp);
else
file_size += fprintf(out, "Logging started ...\n\n%s", timestamp);
if (!args.http_url.empty() || !args.irc_server.empty()) {
switch (fork()) {
case -1: error(0, errno, "Error while forking remote-posting process");
case 0:
start_remote_upload(); // child process will upload the .log.i files
exit(EXIT_SUCCESS);
}
}
}