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:
parent
aa0812690d
commit
59976aed4e
|
@ -510,14 +510,22 @@ int main(int argc, char **argv)
|
||||||
error(EXIT_FAILURE, errno, "Error opening output file '%s'", args.logfile.c_str());
|
error(EXIT_FAILURE, errno, "Error opening output file '%s'", args.logfile.c_str());
|
||||||
|
|
||||||
file_size = 0; // new log file is now empty
|
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 -1: error(0, errno, "Error while forking remote-posting process");
|
||||||
case 0:
|
case 0:
|
||||||
start_remote_upload(); // child process will upload the .log.i files
|
start_remote_upload(); // child process will upload the .log.i files
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue