$OpenBSD: patch-mod_bandwidth_c,v 1.3 2007/06/27 18:57:48 simon Exp $
--- mod_bandwidth.c.orig	Thu Jun 21 09:46:46 2007
+++ mod_bandwidth.c	Thu Jun 21 09:48:12 2007
@@ -145,11 +145,15 @@
  *  /==== by Awesome Walrus <walrus@amur.ru> =====================\
  * -  BandWidthDataDir
  *    Syntax  : BandWidthDataDir <directory>
- *    Default : "/tmp/apachebw"
+ *    Default : "tmp/apachebw"
  *    Context : server config
  *
  *    Sets the name of the directory used by mod_bandwidth to store
  *    its internal temporary information.
+ *    If Apache is running in a chroot(2), this directive must be
+ *    set relatively to ServerRoot ("tmp/apachebw").
+ *    If Apache is running in an "unsecure" not chroot(2)ed mode,
+ *    then the absolute path is needed ("/var/www/tmp/apachebw")
  *  \==== by Awesome Walrus <walrus@amur.ru> =====================/
  *
  * -  BandWidthModule 
@@ -500,7 +504,8 @@ static const char *bandwidthmodule(cmd_parms *cmd, ban
 static const char *set_bandwidth_data_dir(cmd_parms *cmd, void *dummy, char *arg) {
     arg = ap_os_canonical_filename(cmd->pool, arg);
 
-    if (!ap_is_directory(arg)) {
+    const char *fpath = ap_server_root_relative(cmd->pool, arg);
+    if (!ap_is_directory(fpath)) {
         return "BandWidthDataDir must be a valid directory";
     }
     ap_cpystrn(bandwidth_data_dir, arg, sizeof(bandwidth_data_dir));
