diff -ur ./djbdns-1.05-orig/Makefile ./djbdns-1.05/Makefile
--- ./djbdns-1.05-orig/Makefile	2001-02-11 16:11:23.000000000 -0500
+++ ./djbdns-1.05/Makefile	2003-03-05 12:32:41.000000000 -0500
@@ -228,11 +228,11 @@
 dns.a: \
 makelib dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o dns_ipq.o dns_mx.o \
 dns_name.o dns_nd.o dns_packet.o dns_random.o dns_rcip.o dns_rcrw.o \
-dns_resolve.o dns_sortip.o dns_transmit.o dns_txt.o
+dns_resolve.o dns_sortip.o dns_transmit.o dns_txt.o auto_home.o
 	./makelib dns.a dns_dfd.o dns_domain.o dns_dtda.o dns_ip.o \
 	dns_ipq.o dns_mx.o dns_name.o dns_nd.o dns_packet.o \
 	dns_random.o dns_rcip.o dns_rcrw.o dns_resolve.o \
-	dns_sortip.o dns_transmit.o dns_txt.o
+	dns_sortip.o dns_transmit.o dns_txt.o auto_home.o
 
 dns_dfd.o: \
 compile dns_dfd.c error.h alloc.h byte.h dns.h stralloc.h gen_alloc.h \
@@ -287,13 +287,13 @@
 dns_rcip.o: \
 compile dns_rcip.c taia.h tai.h uint64.h openreadclose.h stralloc.h \
 gen_alloc.h byte.h ip4.h env.h dns.h stralloc.h iopause.h taia.h \
-taia.h
+taia.h auto_home.h alloc.h
 	./compile dns_rcip.c
 
 dns_rcrw.o: \
 compile dns_rcrw.c taia.h tai.h uint64.h env.h byte.h str.h \
 openreadclose.h stralloc.h gen_alloc.h dns.h stralloc.h iopause.h \
-taia.h taia.h
+taia.h taia.h auto_home.h alloc.h
 	./compile dns_rcrw.c
 
 dns_resolve.o: \
@@ -328,14 +328,14 @@
 
 dnscache-conf: \
 load dnscache-conf.o generic-conf.o auto_home.o libtai.a buffer.a \
-unix.a byte.a
+unix.a byte.a alloc.a
 	./load dnscache-conf generic-conf.o auto_home.o libtai.a \
-	buffer.a unix.a byte.a 
+	buffer.a unix.a byte.a alloc.a
 
 dnscache-conf.o: \
 compile dnscache-conf.c hasdevtcp.h strerr.h buffer.h uint32.h taia.h \
 tai.h uint64.h str.h open.h error.h exit.h auto_home.h generic-conf.h \
-buffer.h
+buffer.h stralloc.h alloc.h
 	./compile dnscache-conf.c
 
 dnscache.o: \
@@ -695,8 +695,8 @@
 	./compile query.c
 
 random-ip: \
-load random-ip.o dns.a libtai.a buffer.a unix.a byte.a
-	./load random-ip dns.a libtai.a buffer.a unix.a byte.a 
+load random-ip.o dns.a libtai.a buffer.a unix.a byte.a alloc.a
+	./load random-ip dns.a libtai.a buffer.a unix.a byte.a alloc.a
 
 random-ip.o: \
 compile random-ip.c buffer.h exit.h fmt.h scan.h dns.h stralloc.h \
diff -ur ./djbdns-1.05-orig/dns_rcip.c ./djbdns-1.05/dns_rcip.c
--- ./djbdns-1.05-orig/dns_rcip.c	2001-02-11 16:11:23.000000000 -0500
+++ ./djbdns-1.05/dns_rcip.c	2003-03-05 12:32:41.000000000 -0500
@@ -4,6 +4,9 @@
 #include "ip4.h"
 #include "env.h"
 #include "dns.h"
+#include "auto_home.h"
+#include "alloc.h"
+#include "stralloc.h"
 
 static stralloc data = {0};
 
@@ -28,7 +31,14 @@
     }
 
   if (!iplen) {
-    i = openreadclose("/etc/resolv.conf",&data,64);
+    {
+      stralloc path = {0};
+      if (!stralloc_copys(&path,auto_home)) return -1;
+      if (!stralloc_cats(&path,"/etc/resolv.conf")) return -1;
+      if (!stralloc_0(&path)) return -1;
+      i = openreadclose(path.s,&data,64);
+      alloc_free(path.s);
+    }
     if (i == -1) return -1;
     if (i) {
       if (!stralloc_append(&data,"\n")) return -1;
diff -ur ./djbdns-1.05-orig/dns_rcrw.c ./djbdns-1.05/dns_rcrw.c
--- ./djbdns-1.05-orig/dns_rcrw.c	2001-02-11 16:11:23.000000000 -0500
+++ ./djbdns-1.05/dns_rcrw.c	2003-03-05 12:32:41.000000000 -0500
@@ -5,6 +5,9 @@
 #include "str.h"
 #include "openreadclose.h"
 #include "dns.h"
+#include "auto_home.h"
+#include "stralloc.h"
+#include "alloc.h"
 
 static stralloc data = {0};
 
@@ -19,9 +22,16 @@
   if (!stralloc_copys(rules,"")) return -1;
 
   x = env_get("DNSREWRITEFILE");
-  if (!x) x = "/etc/dnsrewrite";
+  {
+    stralloc path = {0};
+    if (!stralloc_copys(&path,auto_home)) return -1;
+    if (!stralloc_cats(&path,"/etc/dnsrewrite")) return -1;
+    if (!stralloc_0(&path)) return -1;
+    if (!x) x = path.s;
 
-  i = openreadclose(x,&data,64);
+    i = openreadclose(x,&data,64);
+    alloc_free(path.s);
+  }
   if (i == -1) return -1;
 
   if (i) {
@@ -61,7 +71,14 @@
     return 0;
   }
 
-  i = openreadclose("/etc/resolv.conf",&data,64);
+  {
+    stralloc path = {0};
+    if (!stralloc_copys(&path,auto_home)) return -1;
+    if (!stralloc_cats(&path,"/etc/resolv.conf")) return -1;
+    if (!stralloc_0(&path)) return -1;
+    i = openreadclose(path.s,&data,64);
+    alloc_free(path.s);
+  }
   if (i == -1) return -1;
 
   if (i) {
diff -ur ./djbdns-1.05-orig/dnscache-conf.c ./djbdns-1.05/dnscache-conf.c
--- ./djbdns-1.05-orig/dnscache-conf.c	2001-02-11 16:11:23.000000000 -0500
+++ ./djbdns-1.05/dnscache-conf.c	2003-03-05 12:32:41.000000000 -0500
@@ -16,6 +16,8 @@
 #include "exit.h"
 #include "auto_home.h"
 #include "generic-conf.h"
+#include "stralloc.h"
+#include "alloc.h"
 
 #define FATAL "dnscache-conf: fatal: "
 
@@ -24,6 +26,11 @@
   strerr_die1x(100,"dnscache-conf: usage: dnscache-conf acct logacct /dnscache [ myip ]");
 }
 
+void nomem(void)
+{
+  strerr_die2x(111,FATAL,"out of memory");
+}
+
 int fdrootservers;
 char rootserversbuf[64];
 buffer ssrootservers;
@@ -89,13 +96,23 @@
   if (chdir(auto_home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",auto_home,": ");
 
-  fdrootservers = open_read("/etc/dnsroots.local");
-  if (fdrootservers == -1) {
-    if (errno != error_noent)
-      strerr_die2sys(111,FATAL,"unable to open /etc/dnsroots.local: ");
-    fdrootservers = open_read("/etc/dnsroots.global");
-    if (fdrootservers == -1)
-      strerr_die2sys(111,FATAL,"unable to open /etc/dnsroots.global: ");
+  {
+    stralloc path = {0};
+    if (!stralloc_copys(&path,auto_home)) nomem();
+    if (!stralloc_cats(&path,"/etc/dnsroots.local")) nomem();
+    if (!stralloc_0(&path)) nomem();
+    fdrootservers = open_read(path.s);
+    if (fdrootservers == -1) {
+      if (errno != error_noent)
+        strerr_die4sys(111,FATAL,"unable to open ",auto_home,"/etc/dnsroots.local: ");
+      path.len -= 6;
+      if (!stralloc_cats(&path,"global")) nomem();
+      if (!stralloc_0(&path)) nomem();
+      fdrootservers = open_read(path.s);
+      if (fdrootservers == -1)
+        strerr_die4sys(111,FATAL,"unable to open ",auto_home,"/etc/dnsroots.global: ");
+      alloc_free(path.s);
+    }
   }
 
   init(dir,FATAL);
diff -ur ./djbdns-1.05-orig/hier.c ./djbdns-1.05/hier.c
--- ./djbdns-1.05-orig/hier.c	2001-02-11 16:11:23.000000000 -0500
+++ ./djbdns-1.05/hier.c	2003-03-05 12:32:41.000000000 -0500
@@ -2,10 +2,11 @@
 
 void hier()
 {
-  c("/","etc","dnsroots.global",-1,-1,0644);
-
   h(auto_home,-1,-1,02755);
   d(auto_home,"bin",-1,-1,02755);
+  d(auto_home,"etc",-1,-1,02755);
+
+  c(auto_home,"etc","dnsroots.global",-1,-1,0644);
 
   c(auto_home,"bin","dnscache-conf",-1,-1,0755);
   c(auto_home,"bin","tinydns-conf",-1,-1,0755);

