+ if(locklog) {
+ if(fstat(fileno(out), &olds)) {
+ flog(LOG_ERR, "accesslog: could not stat current logfile(?!): %s", strerror(errno));
+ return;
+ }
+ if(!stat(outname, &news)) {
+ if((olds.st_dev == news.st_dev) && (olds.st_ino == news.st_ino)) {
+ /*
+ * This needs to be ignored, because if the same logfile
+ * is opened and then closed, the lock is lost. To quote
+ * the Linux fcntl(2) manpage: "This is bad." No kidding.
+ *
+ * Technically, there is a race condition here when the
+ * file has been stat'ed but not yet opened, where the old
+ * log file, having been previously renamed, changes name
+ * back to the name accesslog knows and is thus reopened
+ * regardlessly, but I think that might fit under the
+ * idiom "pathological case". It should, at least, not be
+ * a security problem.
+ */
+ flog(LOG_INFO, "accesslog: received SIGHUP, but logfile has not changed, so ignoring");
+ return;
+ }
+ }
+ }