Commit 7a4da8d1 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Rotate log on SIGHUP

parent 0b2ae6b0
......@@ -92,9 +92,7 @@
" them. The file will be overwritten unless the -a option" \
" was specified. If the application receives a SIGHUP" \
" while writing to a file, it will reopen the file" \
" allowing the old one to be rotated away.\n" \
"\n" \
"XXX: Log rotation not yet implemented" \
" allowing the old one to be rotated away." \
)
#define VSL_OPT_x \
......
......@@ -259,6 +259,18 @@ VUT_Main(VSLQ_dispatch_f *func, void *priv)
}
while (!VUT.sigint) {
if (VUT.w_arg && VUT.sighup) {
/* Rotate log */
VUT.sighup = 0;
AN(VUT.fo);
fclose(VUT.fo);
VUT.fo = VSL_WriteOpen(VUT.vsl, VUT.w_arg, 0,
VUT.u_opt);
if (VUT.fo == NULL)
VUT_Error(1, "Can't open output file (%s)",
VSL_Error(VUT.vsl));
}
if (VUT.vslq == NULL) {
AZ(VUT.r_arg);
AN(VUT.vsm);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment