summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2002-07-17 11:19:11 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2002-07-17 11:19:11 +0000
commitab2d3d71dcb581ce54b93c3f79a961c9f9c0a994 (patch)
tree5835114e2955a8fdac0158b488c354ec2fd10847 /usr.sbin
parentac871b980828875d530df5e10dedc81af51c1d40 (diff)
o add ap_server_chroot_desired in http_main which just returns ap_server_chroot
o fdcache clean up on exit o use fdcache for mod_log_config. survives graceful restarts now as long as no new logfile has to be opened. the latter is impossible because we lack the permission to do so once started.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/httpd/src/main/http_main.c7
-rw-r--r--usr.sbin/httpd/src/modules/standard/Makefile.tmpl3
-rw-r--r--usr.sbin/httpd/src/modules/standard/mod_log_config.c9
3 files changed, 16 insertions, 3 deletions
diff --git a/usr.sbin/httpd/src/main/http_main.c b/usr.sbin/httpd/src/main/http_main.c
index d0f6d7c32dc..f2fd92d826f 100644
--- a/usr.sbin/httpd/src/main/http_main.c
+++ b/usr.sbin/httpd/src/main/http_main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: http_main.c,v 1.16 2002/07/16 14:08:34 henning Exp $ */
+/* $OpenBSD: http_main.c,v 1.17 2002/07/17 11:19:10 henning Exp $ */
/* ====================================================================
* The Apache Software License, Version 1.1
@@ -2603,6 +2603,7 @@ static void clean_parent_exit(int code)
#ifdef EAPI
ap_kill_alloc_shared();
#endif
+ fdcache_closeall();
exit(code);
}
@@ -8045,3 +8046,7 @@ API_EXPORT(int) ap_server_is_chrooted()
return(is_chrooted);
}
+API_EXPORT(int) ap_server_chroot_desired()
+{
+ return(ap_server_chroot);
+}
diff --git a/usr.sbin/httpd/src/modules/standard/Makefile.tmpl b/usr.sbin/httpd/src/modules/standard/Makefile.tmpl
index d261719a7e5..2211d16dd47 100644
--- a/usr.sbin/httpd/src/modules/standard/Makefile.tmpl
+++ b/usr.sbin/httpd/src/modules/standard/Makefile.tmpl
@@ -165,7 +165,8 @@ mod_log_config.o: mod_log_config.c $(INCDIR)/httpd.h \
$(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \
$(INCDIR)/ap_alloc.h $(INCDIR)/buff.h $(INCDIR)/ap.h \
$(INCDIR)/util_uri.h $(INCDIR)/http_config.h \
- $(INCDIR)/http_core.h $(INCDIR)/http_log.h
+ $(INCDIR)/http_core.h $(INCDIR)/http_log.h \
+ $(INCDIR)/fdcache.h
mod_log_referer.o: mod_log_referer.c $(INCDIR)/httpd.h \
$(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \
$(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \
diff --git a/usr.sbin/httpd/src/modules/standard/mod_log_config.c b/usr.sbin/httpd/src/modules/standard/mod_log_config.c
index b7bcd717e72..9c512a597e7 100644
--- a/usr.sbin/httpd/src/modules/standard/mod_log_config.c
+++ b/usr.sbin/httpd/src/modules/standard/mod_log_config.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: mod_log_config.c,v 1.11 2002/07/17 11:19:10 henning Exp $ */
+
/* ====================================================================
* The Apache Software License, Version 1.1
*
@@ -183,6 +185,7 @@
#include "http_config.h"
#include "http_core.h" /* For REMOTE_NAME */
#include "http_log.h"
+#include "fdcache.h"
#include <limits.h>
module MODULE_VAR_EXPORT config_log_module;
@@ -1102,7 +1105,11 @@ static config_log_state *open_config_log(server_rec *s, pool *p,
}
else {
char *fname = ap_server_root_relative(p, cls->fname);
- if ((cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode)) < 0) {
+ if (ap_server_chroot_desired())
+ cls->log_fd = fdcache_open(fname, xfer_flags, xfer_mode);
+ else
+ cls->log_fd = ap_popenf(p, fname, xfer_flags, xfer_mode);
+ if (cls->log_fd < 0) {
ap_log_error(APLOG_MARK, APLOG_ERR, s,
"could not open transfer log file %s.", fname);
exit(1);