+ log_pid = getpid();
+}
+
+static void
+log_switch(struct tm *tm)
+{
+ int fd;
+ char name[64];
+
+ if (!log_name_patt[0] ||
+ log_name[0] && !log_params)
+ return;
+ strftime(name, sizeof(name), log_name_patt, tm);
+ if (!strcmp(name, log_name))
+ return;
+ strcpy(log_name, name);
+ fd = open(name, O_WRONLY | O_CREAT | O_APPEND, 0666);
+ if (fd < 0)
+ die("Unable to open log file %s: %m", name);
+ close(2);
+ dup(fd);
+ close(fd);