[BusyBox] Fixes for Red Hat 7.0 (glibc 2.1.92)

Pavel Roskin proski at gnu.org
Thu Sep 28 16:10:22 UTC 2000


Hello, Ken!

> Unfortunately, the OPEN_MAX fix (glibc 2.2 no longer includes it) requires 
> calling sysconf, which adds 64 bytes to the executable.  Oh well.  C'est 
> la vie, n'est-ce pas?

I don't think your approach is correct.
Ifdefs with version nubmers is IMO the last resort.

If the problem is with OPEN_MAX not being defined then use "#ifndef
OPEN_MAX" and add a comment about new glibc.

If you are worried about EM_486 not being defined use "#ifdef EM_486".

How about this:
____________________
Index: insmod.c
--- insmod.c	Mon Sep 25 14:08:27 2000
+++ insmod.c	Thu Sep 28 12:07:25 2000
@@ -323,7 +323,12 @@
 /* this is the previous behavior, but it does result in
    insmod.c being broken on anything except i386 */
 
+#ifndef EM_486
+#define MATCH_MACHINE(x)  (x == EM_386)
+#else
 #define MATCH_MACHINE(x)  (x == EM_386 || x == EM_486)
+#endif
+
 #define SHT_RELM	SHT_REL
 #define Elf32_RelM	Elf32_Rel
 
Index: update.c
--- update.c	Mon Sep 25 14:08:27 2000
+++ update.c	Thu Sep 28 12:03:58 2000
@@ -72,7 +72,12 @@
 		/* Become a proper daemon */
 		setsid();
 		chdir("/");
+#ifdef OPEN_MAX
 		for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
+#else
+		/* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
+		for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
+#endif
 
 		/*
 		 * This is no longer necessary since 1.3.5x, but it will harmlessly
____________________

Regards,
Pavel Roskin






More information about the busybox mailing list