From 6e1c4d0da3ba45b4a1c2bfba79b07216dcb252b9 Mon Sep 17 00:00:00 2001
From: Mike Baker <mbm@openwrt.org>
Date: Sat, 26 Feb 2005 02:32:16 +0000
Subject: [PATCH] bugfix

SVN-Revision: 294
---
 openwrt/Makefile                                   | 2 ++
 openwrt/package/openwrt/jffs2root.c                | 5 ++++-
 openwrt/target/default/target_skeleton/etc/preinit | 6 +++---
 openwrt/target/squashfs-lzma/squashfslzmaroot.mk   | 1 -
 openwrt/target/squashfs/squashfsroot.mk            | 1 -
 5 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/openwrt/Makefile b/openwrt/Makefile
index dfa272120b..b8c9b10b70 100644
--- a/openwrt/Makefile
+++ b/openwrt/Makefile
@@ -118,6 +118,8 @@ $(TARGET_DIR):
 	fi;
 	-find $(TARGET_DIR) -type d -name CVS | xargs rm -rf
 	-find $(TARGET_DIR) -type d -name .svn | xargs rm -rf
+	-ln -sf /tmp/resolv.conf $(TARGET_DIR)
+	-mkdir -p $(TARGET_DIR)/jffs
 
 source: $(TARGETS_SOURCE)
 
diff --git a/openwrt/package/openwrt/jffs2root.c b/openwrt/package/openwrt/jffs2root.c
index e74c89a9ba..2ff37fdad3 100644
--- a/openwrt/package/openwrt/jffs2root.c
+++ b/openwrt/package/openwrt/jffs2root.c
@@ -48,7 +48,10 @@ void init_crc32()
     unsigned long crc;
     unsigned long poly = 0xEDB88320L;
     int n, bit;
-    crc32 = (unsigned long *) malloc(256 * sizeof(unsigned long));
+    if ((crc32 = (unsigned long *) malloc(256 * sizeof(unsigned long))) == (void *)-1) {
+	    perror("malloc");
+	    exit(1);
+    }
     for (n = 0; n < 256; n++) {
 	crc = (unsigned long) n;
 	for (bit = 0; bit < 8; bit++)
diff --git a/openwrt/target/default/target_skeleton/etc/preinit b/openwrt/target/default/target_skeleton/etc/preinit
index d2036f4e59..28fe805260 100755
--- a/openwrt/target/default/target_skeleton/etc/preinit
+++ b/openwrt/target/default/target_skeleton/etc/preinit
@@ -11,10 +11,10 @@ else
     mtd unlock mtd4
     mount -t jffs2 /dev/mtdblock/4 /jffs
     pivot_root /jffs /jffs/rom
-    mount none /dev -t devfs
-    mount none /proc -t proc
-    umount rom/proc
   }
+  mount none /dev -t devfs
+  mount none /proc -t proc
+  umount rom/proc
 fi
 mount none /tmp -t ramfs
 exec /sbin/init
diff --git a/openwrt/target/squashfs-lzma/squashfslzmaroot.mk b/openwrt/target/squashfs-lzma/squashfslzmaroot.mk
index 4059896bc9..722c20524e 100644
--- a/openwrt/target/squashfs-lzma/squashfslzmaroot.mk
+++ b/openwrt/target/squashfs-lzma/squashfslzmaroot.mk
@@ -39,7 +39,6 @@ squashfslzma-dirclean:
 squashfslzmaroot: squashfslzma
 	@rm -rf $(TARGET_DIR)/usr/man
 	@rm -rf $(TARGET_DIR)/usr/info
-	@mkdir -p $(TARGET_DIR)/jffs
 	$(SQUASHFSLZMA_DIR)/squashfs-tools/mksquashfs-lzma $(TARGET_DIR) $(IMAGE).squashfslzma -noappend -root-owned -le
 
 squashfslzmaroot-source: squashfslzma-source
diff --git a/openwrt/target/squashfs/squashfsroot.mk b/openwrt/target/squashfs/squashfsroot.mk
index 62b645a883..d3a104a83f 100644
--- a/openwrt/target/squashfs/squashfsroot.mk
+++ b/openwrt/target/squashfs/squashfsroot.mk
@@ -38,7 +38,6 @@ squashfs-dirclean:
 squashfsroot: squashfs
 	@rm -rf $(TARGET_DIR)/usr/man
 	@rm -rf $(TARGET_DIR)/usr/info
-	@mkdir -p $(TARGET_DIR)/jffs
 	$(SQUASHFS_DIR)/squashfs-tools/mksquashfs $(TARGET_DIR) $(IMAGE).squashfs -noappend -root-owned -le
 
 squashfsroot-source: squashfs-source
-- 
2.30.2